{"id":1805,"date":"2014-10-22T15:43:02","date_gmt":"2014-10-22T10:13:02","guid":{"rendered":"http:\/\/codetheory.in\/?p=1805"},"modified":"2014-10-25T20:44:07","modified_gmt":"2014-10-25T15:14:07","slug":"get-application-apk-file-from-android-device-to-your-computer","status":"publish","type":"post","link":"https:\/\/codetheory.in\/get-application-apk-file-from-android-device-to-your-computer\/","title":{"rendered":"Get Application APK File from Android Device To Your Computer"},"content":{"rendered":"

In this quick tip, we’ll see how to use the excellent Android Debug Bridge<\/a> (adb) tool on the command line to list all the installed packages on our android device (non-rooted in my case) and then extract one of their APK files to our computer.<\/p>\n

<\/p>\n

List Packages<\/h3>\n

Using the package manager (pm) we can get a list of all the installed packages within the adb shell. Note:<\/strong> If there are multiple devices connected to adb then you’ll need to direct the command<\/a> to the device of your choice.<\/p>\n

\r\n$ adb shell pm list packages\r\n...\r\npackage:org.coursera.android\r\npackage:com.quizup.core\r\npackage:com.airbnb.android\r\n...\r\n<\/pre>\n

Once you have the list with you, determine the package name you want to APK of. For some reason the developers of the app might choose to call the package name something that is completed unrelated to the app name. In that case find the app on Google Play Store where the URL of the app will contain the package name.<\/p>\n

Get the APK Path<\/h3>\n

Next, we’ll need to get the path of the desired android package using the package manager again. Let’s try with com.airbnb.android (Airbnb app) in this case:<\/p>\n

\r\n$ adb shell pm path com.airbnb.android\r\npackage:\/data\/app\/com.airbnb.android-1.apk\r\n<\/pre>\n

The output is the path of the APK file on the device’s filesystem.<\/p>\n

Pull the APK<\/h3>\n

Finally, we’ll need to pull the APK file from the Android device (or emulator) to our computer (development box) using adb pull<\/code>.<\/p>\n

\r\n$ adb pull \/data\/app\/com.airbnb.android-1.apk\r\n3484 KB\/s (12796521 bytes in 3.586s)\r\n<\/pre>\n

Your app APK file should be lying in the current working directory then.<\/p>\n

\r\n$ las -alh\r\n...\r\n-rw-r--r--    1 rishabhpugalia  staff    12M Oct 22 15:37 com.airbnb.android-1.apk\r\n...\r\n<\/pre>\n

Hope that helps!<\/p>\n","protected":false},"excerpt":{"rendered":"

In this quick tip, we’ll see how to use the excellent Android Debug Bridge (adb) tool on the command line to list all the installed packages on our android device (non-rooted in my case) and then extract one of their APK files to our computer.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[121,40],"tags":[105,89],"_links":{"self":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/1805"}],"collection":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/comments?post=1805"}],"version-history":[{"count":4,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/1805\/revisions"}],"predecessor-version":[{"id":1818,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/posts\/1805\/revisions\/1818"}],"wp:attachment":[{"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/media?parent=1805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/categories?post=1805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codetheory.in\/wp-json\/wp\/v2\/tags?post=1805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}