Difference between revisions of "Android Debug Bridge - adb shell guide"

From thelinuxwiki
Jump to: navigation, search
(backup a particular app / apk)
Line 55: Line 55:
  
 
  $ '''adb pull /data/app/com.abccorp.abccorp_app-fww9oZOScSyUhl26nLwn6g==/base.apk abccorp_app_1.1.1'''
 
  $ '''adb pull /data/app/com.abccorp.abccorp_app-fww9oZOScSyUhl26nLwn6g==/base.apk abccorp_app_1.1.1'''
 +
/data/app/com.abccorp.abccorp_app-fww9oZOScSyUhl26nLwn6g==/base.apk: 1 file pulled. 13.9 MB/s (29403087 bytes in 2.014s)
  
 
*** where filename is the string provided by the package list up to .apk
 
*** where filename is the string provided by the package list up to .apk
 
     and
 
     and
 
     where abccorp_app_1.1.1 is the filename of your choosing. I get the app version from the android gui on the device apps list. I don't know of a way to get it from adb.
 
     where abccorp_app_1.1.1 is the filename of your choosing. I get the app version from the android gui on the device apps list. I don't know of a way to get it from adb.
 
  
 
==links==
 
==links==

Revision as of 17:09, 28 January 2022

Android Debug Bridge

connecting to a physical phone using adb

enable developer usb debugging

go to and enable: Settings > Applications > Development > USB debugging

enabling app installation

go to and enable: Settings > Applications > Unknown sources


command line

The adb command line utility is installed as part of the Android SDK

list locally attached devices

$ adb devices
List of devices attached 
c7b5b844        device

run shell interactively

$ adb shell
shell@android:/ $ 

at this point you are connected to your device. You can move around the phone file system, list files, etc..

copy files off the device

 $ adb pull /pathtofileondevice localfilename

copy files to the device

 $ adb push localfilename /pathtofileondevice

backup a device

I attempted the below procedure but the backup would hang at the shared storage (sdcard).

$adb backup -shared -all -f my_backup_file
Now unlock your device and confirm the backup operation.

You will be promped on screed at the device to confirm the backup by selecting "Back up my data". You can also choose to encrypt the backup file and lock it with a password. (android 4.2.2)

backup a particular app / apk

grep for package in list

usage options: -3: Filter to only show third party packages, -f: See their associated file

$ adb shell pm list packages -f -3 | grep abccorp_app
package:/data/app/com.abccorp.abccorp_app-fww9oZOScSyUhl26nLwn6g==/base.apk=com.abccorp.abccorp

pull apk from phone

$ adb pull <filename on device> <local filename>
$ adb pull /data/app/com.abccorp.abccorp_app-fww9oZOScSyUhl26nLwn6g==/base.apk abccorp_app_1.1.1
/data/app/com.abccorp.abccorp_app-fww9oZOScSyUhl26nLwn6g==/base.apk: 1 file pulled. 13.9 MB/s (29403087 bytes in 2.014s)
      • where filename is the string provided by the package list up to .apk
   and
   where abccorp_app_1.1.1 is the filename of your choosing. I get the app version from the android gui on the device apps list. I don't know of a way to get it from adb.

links

Full Android Debug Bridge reference at android.com