Tag Archives: adb: command not found

Solve the problem of ADB: command not found on MAC

Programmer algorithm practice must read, common Java API skills to share>>>

When using MAC for development, sometimes you need to use the ADB instruction to perform some operations. However, if you have not configured the Android environment variables, you may encounter the problem of ADB: command not found. After checking some information, here is a record of how to configure the Android environment variables on Mac

Open the terminal terminal of the Mac and enter Cd ~/[enter the home directory of the current user]

Enter touch. Bash_ Profile [if not. Bash_ Profile, create a file]

Enter open. Bash_ Open the file we created, and a text edit box will pop up. If the environment is configured for the first time, the text edit box will be blank

Write the following code in the open text editor:

export ANDROID_HOME=/usr/local/opt/android-sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

Note the Android in 4_ Home should be filled in according to its own SDK path, and the rest can be copied directly. As for the SDK path, you can open Android studio and search the SDK in preference (Windows setting) to view it

Enter source. Bash in the terminal_ Profile [make our changes effective]

Enter ADB [verify whether the configuration is completed. If the ADB: command not found is not displayed, the configuration is completed]

adb: command not found [How to Solve]

New installation of Ubuntu, the first time to install the Android SDK, enter the command will appear not found

~$ adb
No command 'adb' found, did you mean:
 Command 'cdb' from package 'tinycdb' (main)
 Command 'gdb' from package 'gdb' (main)
 Command 'dab' from package 'bsdgames' (universe)
 Command 'zdb' from package 'zfs-fuse' (universe)
 Command 'mdb' from package 'mono-debugger' (universe)
 Command 'kdb' from package 'elektra-bin' (universe)
 Command 'tdb' from package 'tads2-dev' (multiverse)
 Command 'pdb' from package 'python' (main)
 Command 'jdb' from package 'openjdk-6-jdk' (main)
 Command 'ab' from package 'apache2-utils' (main)
 Command 'ad' from package 'netatalk' (universe)
adb: command not found

No configuration required

vim .bashrc

Then add the following content:

export ANDROID_HOME=/home/jerikc/tools/android/android-sdk-linux
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools

Then run it

. .bashrc
$ adb 
Android Debug Bridge version 1.0.29

 -d                            - directs command to the only connected USB device
                                 returns an error if more than one USB device is present.
 -e                            - directs command to the only running emulator.
                                 returns an error if more than one emulator is running.
 -s <serial number>            - directs command to the USB device or emulator with
                                 the given serial number. Overrides ANDROID_SERIAL
                                 environment variable.
 -p <product name or path>     - simple product name like 'sooner', or
                                 a relative/absolute path to a product
                                 out directory like 'out/target/product/sooner'.
                                 If -p is not specified, the ANDROID_PRODUCT_OUT
                                 environment variable is used, which must
                                 be an absolute path.
 devices                       - list all connected devices
 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.
 disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                 Port 5555 is used by default if no port number is specified.
                                 Using this command with no additional arguments
                                 will disconnect from all connected TCP/IP devices.

device commands:
  adb push <local> <remote>    - copy file/dir to device
  adb pull <remote> [<local>]  - copy file/dir from device
  adb sync [ <directory> ]     - copy host->device only if changed
                                 (-l means list but don't copy)
                                 (see 'adb help all')
  adb shell                    - run remote shell interactively
  adb shell <command>          - run remote shell command
  adb emu <command>            - run emulator console command
  adb logcat [ <filter-spec> ] - View device log
  adb forward <local> <remote> - forward socket connections

The problem has been solved