Sunday, January 17, 2010

Errors trying to run ADB (Android Debug Bridge)?




The Android Debug Bridge (adb) is a tool lets you manage the state of an emulator instance or Android-powered device.

I was trying to run it for the first time on my ubuntu 9.10 box and I kept getting this error:


desktop:~/dev/Android/android-sdk-linux/tools$ adb
No command 'adb' found, did you mean:
Command 'cdb' from package 'tinycdb' (main)
Command 'gdb' from package 'gdb' (main)
Command 'aub' from package 'aub' (universe)
Command 'dab' from package 'bsdgames' (universe)
Command 'mdb' from package 'mono-debugger' (universe)
Command 'arb' from package 'arb' (multiverse)
Command 'tdb' from package 'tads2-dev' (multiverse)
Command 'pdb' from package 'python' (main)
Command 'jdb' from package 'openjdk-6-jdk' (main)
Command 'jdb' from package 'sun-java6-jdk' (multiverse)
Command 'ab' from package 'apache2-utils' (main)
adb: command not found


What was I doing wrong?

A quick google search shows me the error of my ways.. I haven't added my Android SDK tools directory to my system path!


It should go something like this...

open a terminal window and type:

$ echo $PATH
---(should return the directories associated with $PATH)

$ export PATH=$PATH:/home/YOUR-USERNAME/sdk/tools
---(replace with path to your tools directory, you may need to add 'sudo' to the beginning of this cmd)
Update: later versions of the SDK have ADB moved to the platform-tools directory, so adjust the above accordingly.


$ echo $PATH
---(you should now see your tools directory added to the end of the $PATH variable)

$ adb devices
---(now adb should do something, if nothing else at least error, no devices)


And now I get:

List of devices attached
emulator-5554 device


Sweet Success!

p.s. Adding to the system path in Windows is along the lines of :
  1. right-click '(My) Computer'
  2. Select 'Properties'
  3. Go to 'Advanced' or whatever tab you find 'Environment Variables'
  4. Select 'Path' then 'Edit' and add your new path in.
Update: if you are using 64-bit linux you may need to also install the ia32-libs package like so:

sudo apt-get install ia32-libs



18 comments:

  1. When I do "export PATH=$PATH:/home/myusername/sdk/tools" it says

    "Export not found"

    help please

    ReplyDelete
  2. Hi Speedy,
    .. Are you sure that you've got the correct path listed to your tools directory?

    I've just re-run mine to check and this is what I need to run for my current sdk location:

    "export PATH=$PATH:/home/glenn/Dev/android-sdk-linux_x86/tools"

    ..That works for me.

    I think you might have your path incorrect.
    Actually, I got the same error when I included a 'sudo' at the front, so if you're doing that, try it without it.

    If you're using Eclipse, the easiest way to find the path is go into Window\Preferences\Android and copy that and add a 'tools' on the end.

    Hope that helps,
    Glenn

    ReplyDelete
  3. OK but now I get "* daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached
    ???????????? no permissions"

    ReplyDelete
  4. Ok I think I got it now.

    it says


    "* daemon not running. starting it now on port 5037 *
    * daemon started successfully *"

    ReplyDelete
  5. Awesome.
    Hope it all works, let me know if there's anything else I can help with.

    ReplyDelete
  6. it keeps saying "not recognized as internal or external command......"

    ReplyDelete
  7. Depending on what version of the SDK you downloaded you may need to add the sdk/platform-tools to your system path.

    ReplyDelete
  8. I still get your original error.
    Even if I move into the directory or click on the adb icon in Nautilus it won't seem to do anything.

    ReplyDelete
  9. Hi all

    I want to install flash apk file on android emulator. But when run command ./adb install flash_for_21.apk on linux terminal then error occur.

    Error:

    daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    error: device not found

    please suggest what i do?

    thanks
    awinash kumar

    ReplyDelete
  10. Hi all

    i am install successfully flash apk file on android emulator. Problem is does not open live video.

    What problem not understand.

    thanks
    awinash

    ReplyDelete
  11. Thanks for annnouncement. I can resolve on Ubuntu11.04.

    ReplyDelete
  12. Thanks for this post. I have solved my problem with this help..

    ReplyDelete
  13. I am trying to put this webtop mod on my phone and when I enter the first line: adb push domain_policy.conf /tmp/ I get is device not found error and so far I am not getting any feedback in the forum where the webtop mod is located... Anyone know whats up with this and why its saying this?

    ReplyDelete
  14. Hello,

    I followed your steps, though it still reads the same initial errors, i.e.,
    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 '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 'jdb' from package 'openjdk-7-jdk' (universe)
    Command 'ab' from package 'apache2-utils' (main)
    Command 'ad' from package 'netatalk' (universe)
    adb: command not found

    Any comments as to how am I supposed to proceed?

    Thanks,
    Sachin.

    ReplyDelete
    Replies
    1. Hi Sachin,
      If you type 'echo $PATH' in a terminal do you see your android 'platform-tools' directory?

      Cheers,
      Glenn

      Delete