adb command not found in linux environment

2019-01-13 04:07发布

While implementing the BluetoothChat application .apk inside G1 device, it always pops up a message:

$adb install -r /home/parveen/workspace/BluetoothChat/bin/BluetoothChat.apk 
-bash: adb: command not found

I am not getting clearly why this error is popping up every time. Please help me.

Thanks in advance. Praween

标签: android adb
18条回答
女痞
2楼-- · 2019-01-13 04:47

I found the solution to my problem. In my ~/.bashrc:

export PATH=${PATH}:/path/to/android-sdk/tools

However adb is not located in the android-sdk/tools/, rather in android-sdk/platform-tools/. So I added the following

export PATH=${PATH}:/path/to/android-sdk/tools:/path/to/android-sdk/platform-tools

And that solved the problem for me.

查看更多
相关推荐>>
3楼-- · 2019-01-13 04:49

creating a symbolic link was the solution for me either. However before working I had to grant access and execute rights to the created symbolic links.

I am not sure if it was @eaykin's answer or @crazymacleod's that worked for me, as I did both before finding the above mentioned solution.

Thanks!

查看更多
一夜七次
4楼-- · 2019-01-13 04:53
Follow these steps:

Set android vars

Initially go to your home and press `Ctrl + H` it will show you hidden files now look for .bashrc file, open it with any text editor

then place the lines below at the end of file:

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


Now Reboot the system

It Works!
查看更多
虎瘦雄心在
5楼-- · 2019-01-13 04:54

I had this problem when I was trying to connect my phone and trying to use adb. I did the following

  1. export PATH=$PATH{}:/path/to/android-sdk/tools:/path/to/android/platform-tools

  2. apt-get install ia32-libs

  3. Connected my phone in USB debug mode and In the terminal type lsusb to get a list of all usb devices. Noted the 9 character (xxxx:xxxx) ID to the left of my phone.

  4. sudo gedit /etc/udev/rules.d/99-android.rules

  5. Add [ SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev" TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}" ] (whatever is in [...] )to the file and replace "####:####" with the number from step 3cop

  6. sudo service udev restart

  7. Restarted my System

  8. open terminal browse to adb directory and run ./adb devices

And it shows my phone hence adb starts working without error.

I hope it helps others

查看更多
Melony?
6楼-- · 2019-01-13 04:56

Updating the path as listed above in ~/.bashrc makes other bash commands stop working all together. the easiest way I found is to use what eaykin did but link it your /bin.

[sudo] ln -s /android/platform-tools/adb /bin/adb

No restart is required just type following command -

adb devices

To make sure it's working.

查看更多
Summer. ? 凉城
7楼-- · 2019-01-13 04:57

NOTE: while using adb on Linux you'll need to type ./adb to execute adb commands unless you create a path in ~/.bashrc. In a terminal write:

sudo gedit ~/.bashrc

Add the following line at the end of the file. Once you're done, save and exit.

Android tools

export PATH=~/Development/adt-bundle-linux/sdk/platform-tools:~/Development/adt-bundle-linux/sdk/tools:$PATH

Then in a Terminal run this command to reload your .bashrc: Code:

source ~/.bashrc

Now you can just run adb without put ./ before every command.

查看更多
登录 后发表回答