Wednesday, August 22, 2012

How to install android debug bridge (adb)

Google is making it a challenge to use basic Android tools. The swiss-army knife of Android tinkering is adb. Where do you find it? Not in the SDK. If you download-and-install the r20 SDK, you'll find a note in the tools directory:

The adb tool has moved to platform-tools/

If you don't see this directory in your SDK,
launch the SDK and AVD Manager (execute the android tool)
and install "Android SDK Platform-tools"
I couldn't find anything named "SDK and AVD Manager" in the SDK, but I found the android tool in the tools directory. I even found a suggestion for how to get platform-tools without opening a UI. But...
jason@pinot:~/android/sdk-r20$ ./tools/android update sdk --no-ui
./tools/android: 1: ./tools/android: java: not found
./tools/android: 1: ./tools/android: java: not found
./tools/android: 110: exec: java: not found
After searching around the Ubuntu packages site, I realized I needed to:
sudo apt-get install openjdk-7-jre
Then I reran the android update command (above). Yes, I got the platform-tools (including adb), but I'm also getting tons of other crap I don't want. Maybe running ./tools/android without any arguments would have been better...

Now, the moment of truth:

jason@pinot:~/android/sdk-r20$ ./platform-tools/adb 
./platform-tools/adb: error while loading shared libraries: cannot open shared object file: No such file or directory
You've got to be kidding me.
jason@pinot:~/android/sdk-r20$ sudo apt-get install libncurses5
libncurses5 is already the newest version.
Ah, adb is a 32-bit binary. Do 32-bit Linux installs even exist any more? Anyway,
sudo apt-get install lib32ncurses5 lib32stdc++6
Phew! What a workout! Finally, the reward:
jason@pinot:~/android/sdk-r20$ ./platform-tools/adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
0146B5BB04002013 device
Ah, what a lovely device number.

No comments:

Post a Comment