Building adb and fastboot command from AOSP source code

adb, android debugging brige, is used for connecting your PC and Android devices to get log, send command to Android devices etc which is very useful for Android software development.

fastboot command is used to control bootloader mode for Nexus devices, it can be used to flash new factory image etc.

Here the method of how to build adb command and fastboot command manually from Android Open Source Project source code is written. If you feel it trouble some to build adb and fastboot command manually in your PC, see also

I used Linux OS (Ubuntu 14.4) for following set up.

Step 1. Build Environment setup

If your PC does not have building environment for AOSP yet, you can set up by just following Establishing a Build Environment.

Step 3. Build adb and fastboot

Go to your source code root directory, and set up build environment by

After lunch command, following will appear so that you can choose your buildtype.

You can type number and press enter to proceed. In my case, I want to build for Nexus Player so I chose 10 (aosp_fugu-userdebug).

Finally we can build by

make will takes several minutes to build adb and fastboot.

Step 4. Adding a environment path

Immediately after building, you can find these command by,

It is better to set environment path (because after this log in session finishes, this path setting will be removed).

Step 5. Check function

Finally you can check if fastboot and adb is working correctly or not.

First is to check adb, connect your PC and Android device by USB. Enable developer mode for your Android device, and after enable USB debugging, type

It should show device which PC is connecting to. Try sudo if it is not working.

fastboot

After Nexus reboots with bootloader mode, type

and check if you can see devices or not. try sudo if it is not working, or it says “waiting for devices” forever. If fastboot is not working, you may need to set up Android device udev rules (refer below links).

Reference

3 responses

1. Tim says:

I happen to be building on an old SUSE that doesn’t have 1.8 installed.

I need to build with: JAVA_NOT_REQUIRED=true make adb

2. I want to cross compile a latest ADB server (not adbd!) running on my Raspberry Pi.(armv7-neon)

How should I do? Need Reply ASAP.thx.

• Hi, did you had any luck with building adb for raspberry?