Get APK of installed app

I'm looking for a way to extract the APK file of an installed Android app WITHOUT root permission.

I thought that this was impossible, because all APK files for non-system-apps are located in /data/app, and accessing this folder requires root permission. Then I found there are numerous apps in Google Play that seem to have access to the APK files even on non-rooted devices.

Can someone tell me how this is possible ? Aren't there backup apps which backup the APK files without root?


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

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


Android appends a sequence number to the package name to produce the final APK file name (it's possible that this varies with the version of Android OS). The following sequence of commands works on a non-rooted device:

  • Get the full path name of the APK file for the desired package.

    adb shell pm path com.example.someapp
    

    This gives the output as: package:/data/app/com.example.someapp-2.apk .

  • Pull the APK file from the Android device to the development box.

    adb pull /data/app/com.example.someapp-2.apk
    

  • There is an app on Google play store named "Apk extracter". By this app you can get .apk file of installed app. Get and enjoy!

    链接地址: http://www.djcxy.com/p/31972.html

    上一篇: 从apk文件恢复源代码,但它不一样,我写了

    下一篇: 获取已安装应用的APK