ADB stands for the android debugging bridge and is used for testing and debugging purposes by developers. However, we like to get more out of our devices, and its a great way to fix things. Knowing adb can mean the difference between a paperweight and a working phone.
To start with, you need JDK from Sun/Oracle and Android SDK from Google. Here let me explain some ADB commands,
1. To install an application on your device (sideloading). Unlike installing from the SD card, it does not require unknown sources (settings/development/unknown sources) to be enabled. This assumes that you are working from the directory where the file is located.
This will install the application to /data/app. It will also show sometimes useful errors if install fails.
2. adb shell which logs into the phone.
3. If we end up with a $, we will want admin rights, in many cases. This is not one of them, I don’t beleive.
To get admin rights, you want to type:
4. Look at your phone if this is the first time, it may prompt you to allow access. Else you will get permission denied. If you are not rooted, this will not work either. Now that we are logged in, we will type
5. To disable an application in your device
|
|
adb shell su pm disable appllicationname |
6. To re-enable an application
|
|
adb shell su pm enable applicationname |
7. To reboot your device
8. to reboot into recovery mode (CWM Recovery)
9. To reboot into download mode
10. To push a file to your device
|
|
adb push filename /pathtodirectoryonphone |
eg.
|
|
adb push test.txt /sdcard/ |
11. Pushing files can be done to any directory, however, some are protected. For instance, /system is going to give you a permission denied or a read only filesystem error. To get around this, the easiest thing to do is push the file to your sdcard, then log into the shell:
|
|
We will then mount the system as writable |
|
|
mount -o rw,remount /dev/block/stl9 /system |
|
|
cp /sdcard/test.txt /system/app/test.txt |
cp stands for copy and it requires the path of the file and destination path. The name of the file is optional .When you copy it, you can rename it to whatever you like. For instance, if we wanted to backup a file
|
|
cp /sdcard/test.txt /sdcard/backuptest.txt |
Now, lets assume you do not have busybox installed. You non rooted users will not. Then you must use a slightly more complicated command called dd
This is used like this:
|
|
dd if=/sdcard/test.txt of=/system/app/test.txt |
12. To pull a file, Lets say you want to get a file from your phone, to modify, backup, etc.
To do this, we simply use adb in this manner:
|
|
adb pull /pathtofile/filename destinationname |
|
|
adb pull /system/app/ADWLaucnher.apk ADWLauncher.apk |
13. logcat allows us to log what the OS is doing, and possibly delve information for when things are not working
its quite simple Reading it is another.
To use logcat
To logcat to a certain file do
|
|
adb shell logcat > /sdcard/logcat.txt |
Incoming search terms:
- adb deactivate device admin
- admin rights adb