Issue
How do I get the apk file from an android device? Or how do I transfer the apk file from device to system?
Solution
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")
Answered By - Maurits Rijk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.