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 2. Downloading AOSP Source code

Follow Downloading the Source.

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.  

adb

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

Finally check fastboot. Reboot your Nexus devices with bootloader mode

 

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

Sponsored Links

One response

  1. 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

Leave a Reply to Tim Cancel reply

Your email address will not be published.