List of ADB for Android
Tags: android, adb
Published: 2021-05-20 07:23:18

<p size=50px ><b>==> Install app</b>
<br>
adb install Myapp.apk
<br>
adb -d  install Myapp.apk  //-d (directs command to the connected USB device.)
<br>
adb -e  install Myapp.apk    //-e (directs command to the running emulator.)
<br>
adb -s  install Myapp.apk    //-s <serial number><br>
adb -p  install Myapp.apk    //-p <product name or path><br>
------------------------------------------------------------------<br>

<b>==> Uninstall app<br></b>

adb uninstall com.package.myapp<br>
adb uninstall -k com.facebook.katana //-k Keep the data and cache directories around after package removal.<br>
------------------------------------------------------------------<br>

<b>==> Logcat  </b><br>

adb logcat                       //displays the log data onto the screen<br>
adb logcat -c                    //you can clear the existing logs on an Android device.<br>
adb logcat -d > [path_to_file]   //you can save the logcat output to a file on your computer.<br>
------------------------------------------------------------------<br>

<b>==> Reboot device<br></b>

adb reboot                //ADB can be used to reboot your device, useful when your hardware buttons aren’t working.<br>
adb reboot bootloader     //Reboots the device into the Fastboot or Bootloader mode.<br>
adb reboot recovery       //Reboots the device into recovery mode.<br>

------------------------------------------------------------------<br>

<b>==> Bugreport<br></b>

adb bugreport             //Displays the Android device <br>information such as dumpsys, dumpstate and logcat data on the screen.<br>
adb jdwp                  //Lists the JDWP (Java Debug Wire Protocol) processes on the device. if you’re not already aware of it, chances are you don’t have to worry about it either.<br>

------------------------------------------------------------------<br>

<b>==> Server<br></b>

adb start-server          //Starts the adb server process.<br>
adb kill-server           //Stops the adb server process (terminal adb.exe process).<br>

------------------------------------------------------------------<br>

<b>==> Files<br></b>

adb pull /sdcard/screenrecord.mp4         //This command can be used to pull any files from your device and save it on your computer. To download or pull a file from your Android device to the SDK platform-tools directory, use<br>
adb pull /sdcard/screenrecord.mp4 e:\    //If you want to download a file from your phone’s storage to a specific drive on your computer, execute the this command<br>

adb push Myapp.apk /sdcard               //This command can be used to push a file from your computer to your device. If the file to be pushed it save in the SDK folder, use<br>
adb push e:\Myapp.apk /sdcard            // To push or send a file to your Android from a specific drive on your computer, use<br>

------------------------------------------------------------------<br>

<b>==>  Permissions<br></b>

adb shell pm reset-permissions -p com.package.myapp   // Reset App's permission <br>
adb shell pm grant [packageName] [Permission]         // Grant a permission to an app<br>
adb shell pm revoke [packageName] [Permission]        // Revoke a permission from an app<br>
------------------------------------------------------------------<br>

<b>==> Package info<br></b>

adb shell list packages                // list package names<br>
adb shell list packages -r             // list package name + path to apks<br>
adb shell list packages -3             // list third party package names<br>
adb shell list packages -s             // list only system packages<br>
adb shell list packages -u             // list package names + uninstalled<br>
adb shell dumpsys package packages     // list info on all apps<br>
adb shell dump <name>                  // list info on one package<br>
adb shell path <package>               // path to the apk file<br>
------------------------------------------------------------------<br>

<b>==> Print text<br></b>

adb shell input text 'Hello world'<br>
------------------------------------------------------------------<br>
<b>
==> Screenshot<br></b>

adb shell screencap -p /sdcard/screenshot.png<br>
------------------------------------------------------------------<br>

<b>==> Monkey
<br></b>
adb shell monkey -p com.myAppPackage -v 10000 -s 100    // Monkey is generating 10.000 random events on the device<br>
------------------------------------------------------------------<br>

<b>==> Other</b><br>
adb backup              // Create a full backup of phone and save <br>to the computer
adb restore             // Restore a backup to phone<br>
adb sideload            // Push and flash custom ROMs<br>

------------------------------------------------------------------<br>

<b>==> Connection Managment<br></b>

adb tcpip 5555                 // Set the target device to listen for a TCP/IP connection on port 5555<br>
adb connect 192.168.1.20:5555 // Connect to the device by its IP address<br>
adb disconnect                // Disconnect the USB cable from the target device.<br>
adb devices                   // You can generate a list of attached devices<br>
</p>