How to Get the APK of an Installed App Without Root Access

How do I get the APK of an installed app without root access?

Accessing /data/app is possible without root permission; the permissions on that directory are rwxrwx--x. Execute permission on a directory means you can access it, however lack of read permission means you cannot obtain a listing of its contents -- so in order to access it you must know the name of the file that you will be accessing. Android's package manager will tell you the name of the stored apk for a given package.

To do this from the command line, use adb shell pm list packages to get the list of installed packages and find the desired package.

With the package name, we can get the actual file name and location of the APK using adb shell pm path your-package-name.

And knowing the full directory, we can finally pull the adb using adb pull full/directory/of/the.apk. The APK file gets stored to the directory from which you run your console.

Credit to @tarn for pointing out that under Lollipop, the apk path will be /data/app/your-package-name-1/base.apk

How do I get an apk file from an Android device?

Use adb. With adb pull you can copy files from your device to your system, when the device is attached with USB.

Of course you also need the right permissions to access the directory your file is in. If not, you will need to root the device first.


If you find that many of the APKs are named "base.apk" you can also use this one line command to pull all the APKs off a phone you can access while renaming any "base.apk" names to the package name. This also fixes the directory not found issue for APK paths with seemingly random characters after the name:

for i in $(adb shell pm list packages | awk -F':' '{print $2}'); do 
adb pull "$(adb shell pm path $i | awk -F':' '{print $2}')"
mv base.apk $i.apk &> /dev/null
done

If you get "adb: error: failed to stat remote object" that indicates you don't have the needed permissions. I ran this on a NON-rooted Moto Z2 and was able to download ALL the APKs I did not uninstall (see below) except youtube.

adb shell pm uninstall --user 0 com.android.cellbroadcastreceiver   <--- kills presidential alert app!

(to view users run adb shell pm list users)
This is a way to remove/uninstall (not from the phone as it comes back with factory reset) almost ANY app WITHOUT root INCLUDING system apps (hint the annoying update app that updates your phone line it or not can be found by grepping for "ccc")

Where can I find the .apk file on my device, when I download any app and install?

There is an app in google play known as MyAppSharer. Open the app, search for the app that you have installed, check apk and select share. The app would take some time and build the apk. You can then close the app. The apk of the file is located in /sdcard/MyAppSharer

This does not require rooting your phone and works only for apps that are currently installed on your phone

get APK of installed app with adb command

Pull the APK file from the Android device to the development box by setting destination path.

adb pull /data/app/com.facebook.katana-2/base.apk path/to/desired/destination

or use,

adb shell cat /data/app/com.facebook.katana-2/base.apk > app.apk 

how can generate apk file from installed android application?

All installed APKs are located in /data/app/, but you can see this if you have rooted device

If you don't wants to root your device then there are many application available in market such as MyAppSharer

MyAppSharer is available on google play store.

Download MyAppSharer

The APKs will goes in /sdcard/MyAppSharer

Read .apk of another app from my own app

I found solution in another question, here is direct link to answer in another thread.

I also copied answer here for lazy people.

  1. First you get all installed applications,
  2. For each one, get public source directory.
  3. copy the file to the SDCard.

Note: No need to be rooted.

Here is the snippt code:

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0);
for (Object object : pkgAppsList) {
ResolveInfo info = (ResolveInfo) object;
File file = new File(info.activityInfo.applicationInfo.publicSourceDir);
// Copy the .apk file to wherever
}


Related Topics



Leave a reply



Submit