Android Debug Bridge (ADB)

 Android Debug Bridge (ADB)

It's a command line tool that let's you send instructions to emulators or devices. 

Use case : 

  • Go to terminal 
  • run command : $ adb 
if we get adb: command not found  we have to add the adb to our path 
  • To use this command line, it needs to be part of our path. 
  • First we find where the adb executables live 
  • Then we add them to our path 

Follow the Steps to add the Adb to your path 

1. Find the platform-tools folder which contains adb:

Adb is part of the Android SDK, which is downloaded as part of Android Studio. You can find the location of this SDK by going to Tools -> SDK Manager

ADB is located in this location, followed by platform-tools/ so in the example above, you could find adb in:

/Users/lmf/Library/Android/sdk/platform-tools/

2. Add adb to your path:

Adding a variable to your path varies by platform, follow the instructions below to add the platform-tools location you located above.

Windows

  1. Go to Advanced system settings:
    • Windows 8 and 10: Search -> System (Control Panel) -> Advanced system settings
    • Windows 7: Right-click Computer -> Properties -> Advanced system settings
    • Windows Vista: Right click My Computer -> Properties -> Advanced system settings
    • Windows XP: Start -> Control Panel -> System -> Advanced tab
  2. Click Environment Variables
  3. Find the System Variables section and then look to see if you have a PATH environment variable:
    • If you find one, click Edit
    • If you do not find one, click New to add one
  4. Add ;<Path to platform-tools> to the end of the Variable value box
  5. Click OK on all windows to save
  6. Ensure you can run adb by typing:
    • adb
  7. You should see output, including something like: Android Debug Bridge version 1.x.x 

Mac/Linux

Adding a path variable is done using the terminal on Mac/Linux.

  1. Open a Terminal
  2. Create a .bash_profile file if you don’t have one already. This is a configuration file for bash) - it’s executed when you start bash:
    • touch ~/.bash_profile
  3. Open up the ~/.bash_profile file in your preferred text editor:
    • open ~/.bash_profile
  4. Add the following to your .bash_profile file and save:
    • export PATH=<Path to platform-tools>:$PATH
  5. Either restart your terminal, or enter:
    • source ~/.bash_profile
  6. Ensure you can run adb by typing:
    • adb
  7. You should see output, including something like:  Android Debug Bridge version 1.x.x 



Terminating process in your app 


Run this command : 

adb shell am kill 
com.niranjan.mycoolapp


Comments

Popular Posts