How to obtain file path for .apk file? - android

i am trying to install two apk files which are currently in my downloads folder via the adb shell using adb install path_here.apk. I've right clicked the files to get the file path however, it saying that it can't find the file to install. Is there a way i can correctly obtain the path?

The path is the folder where the file is currently located, and not some kind of "internal apk path". So, try:
adb install folder/where/file/is/located/file.apk

Related

Unable to Extract .apk files from Bluestacks app player using adb

I'm trying to extract .apk files of my apps installed from blue stacks player using adb .I am successful in getting the .apk's of files that are present in the location "/system/app". Below is the command that i gave from my command line
adb pull /system/app C:\xyz\ffff
However,When i am trying to get the .apk of the apps that are present in the location "/data/app" it says
"0 files pulled"
However,I'm pretty much sure it has got over 10 apps.
Any help would be highly helpful
1.Download 'apkextractor' app from playstore and install it in your bluetack, This application can extract the applications installed in bluestack
2.To access this .apk files you need any filemanager, And go to extractedApk directory
3.To move apk files from bluestack to pc folder, Move the .apk files from 'extractedApk' to 'windows/pictures' folder
This screenshot will help you
In the latest versions of Android, APKs are no longer simply stored in the /data/app folder.
To get the list of installed packages (and their paths) run the following:
adb shell pm list packages -f
This will show you packages and paths to the APKs. Like this:
package:/data/app/com.android.chrome-2/base.apk=com.android.chrome
Here, you can see the APK resides at /data/app/com.android.chrome-2/base.apk
Running adb pull /data/app/com.android.chrome-2/base.apk works.
You need to do this for each APK shown in the package list. On non-rooted devices, you cannot search for APKs in the /data/app folder because adb does not have permission to view the contents of folders in this location.

how to get an .apk from my phone to restore my source files

I was importing a .java file from one project to another in Eclipse. In doing so, Eclipse deleted all my .java files and my .apk files from the source project. I know I can rebuild them from an .apk file but the only current one is on my LG phone.
How can I get the .apk off my phone an onto my PC? Do I have to root the phone so that I can see the Data folder? I have Android File Manager but I don't see how to upload to the pc.
Thanks,
Gary
You don't actually need root to pull your APKs from your device. This command will list the location of the APK:
adb shell pm list packages -f
Then you can use adb pull:
adb pull <APK path from previous command>
You shouldn't need root for this.
If you can see the file in your phone's File Manager, why not simply email it to yourself?

In AVD emulator how to see sdcard folder and install an APK to the AVD?

I have created an Android emulator (Android Virtual Device), but I am unable to find out the SD card I have built during creation of this.
How can I find the SD card and its content and also how to install APK files to the AVD?
switch to DDMS perspective
select the emulator in devices list, whose sdcard you want to explore.
open File Explorer tab on right hand side.
expand tree structure. mnt/sdcard/
refer to image below
To install apk manually:
copy your apk to to sdk/platform-tools folder and run following command in the same folder
adb install apklocation.apk
I have used the following procedure.
Procedure to install the apk files in Android Emulator(AVD):
Check your installed directory(ex: C:\Program Files (x86)\Android\android-sdk\platform-tools), whether it has the adb.exe or not). If not present in this folder, then download the attachment here, extract the zip files. You will get adb files, copy and paste those three files inside tools folder
Run AVD manager from C:\Program Files (x86)\Android\android-sdk and start the Android Emulator.
Copy and paste the apk file inside the C:\Program Files (x86)\Android\android-sdk\platform-tools
Go to Start -> Run -> cmd
Type cd “C:\Program Files (x86)\Android\android-sdk\platform-tools”
Type adb install example.apk
After getting success command
Go to Application icon in Android emulator, we can see the your
application
These days the location of the emulated SD card is at /storage/emulated/0
On linux sdcard image is located in:
~/.android/avd/<avd name>.avd/sdcard.img
You can mount it for example with (assuming /mnt/sdcard is existing directory):
sudo mount sdcard.img -o loop /mnt/sdcard
To install apk file use adb:
adb install your_app.apk
DDMS is deprecated in android 3.0. "Device file explorer"can be used to browse files.
Drag & Drop
To install apk in avd, just manually drag and drop the apk file in the opened emulated device
The same if you want to copy a file to the sd card
if you are using Eclipse. You should switch to DDMS perspective from top-right corner there after selecting your device you can see folder tree. to install apk manually you can use adb command
adb install apklocation.apk
I have used the following procedure.
Android Studio 3.4.1
View>Tool Windows>Device File Explorer
//in linux
// in your home folder .android hidden folder is there go to that there you can find the avd folder open that and check your avd name that you created open that and you can see the sdcard.img that is your sdcard file.
//To install apk in linux
$adb install ./yourfolder/myapkfile.apk
Adding to the usefile DDMS/File Explorer solution, for those that don't know, if you want to read a file you need to select the "Pull File from Device" button on the file viewer toolbar. Unfortunately you can't just drag out, or double click to read.

how to copy a file stored in /data/data/com.sai.myproj/files/a.txt to res folder in Android

I have a file stored in /data/data/com.sai.myproj/files/a.txt .This is the file I created and wrote data, it was stored in data/data/com.sai.myproj/files/a.txt which can be viewed using FileExplorer of DDMS. How to copy this file from there to res folder as I need to parse this file .
Can anyone help me in sorting out this issue.
Thanks in Advance,
You can use adb pull on your computer:
adb pull /data/data/com.sai.myproj/files/a.txt your-project-location/res
Adb is located in android-sdk/tools.
AFAIK an installed application cannot write to its own res folder
If you want to copy something from a device into the res folder of your project sources, you can use the adb tool, either from the command line by programmatic usage of the command line as part of a script or .bat file or using the shell exec function of your chosen language on your chosen development platform
Make sure you have the SDK fully installed and that the adb executable is in your path or reference it by its full path name (ie, make sure 'adb shell' works)

Can't add data to Android sdcard on the emulator

I can see the sd card in the file explorer with d--rwxr-x permission. When i tried adding any file to it it shows Failed to push the items. It is not adding even very small files.
Can you guys suggest how to fix this?
This is how you push files to the SD Card. First copy the file you want to push to the tools directory [android-sdk-windows]/tools/. Open a command prompt and if you don't have the tools directory in your path you will need to cd [drive]:\android-sdk-windows\tools. Then you just type this:
adb push [filename] /sdcard/[filename]
If you want to put the file into a subdirectory of sdcard you have to create it... you can do that in the adb shell or on the device with a file manager.
If you are working on Windows.
This site is very useful deltafalcon.com.

Categories

Resources