[Desire Android Development] PaulW21781:
You need to have Sun Java6 JDK Installed, its in a partner repo, so do the following (for Ubuntu 10.04), if you are in 10.10, just change lucid for maverick

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

Then install the required build files:

sudo apt-get install it-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

Now edit your ~/.bashrc file to include the following (if not already done)

#Android Building Specific...
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export ANDROID_JAVA_HOME=$JAVA_HOME
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export ANDROID_SDK_TOOLS=/folder/where/sdk/tools/are/extracted
export ANDROID_PREBUILT_ARMEABI=/folder/where/android/tools/arm-eabi/toolchain/is
export PATH=${PATH}:${JAVA_HOME}/bin:${ANDROID_SDK_TOOLS}:${ANDROID_PREBUILT_ARMEABI}

With the above edits to your .bashrc file, you need to make sure that the 2 variables ANDROID_SDK_TOOLS and ANDROID_PREBUILT_ARMEABI relate to actual folders, for example*(as it is on mine)

export ANDROID_SDK_TOOLS=/home/paulw/Programming/android-sdk-linux_86/tools
export ANDROID_PREBUILT_ARMEABI=/home/paulw/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin

*note* ANDROID_PREBUILT_ARMEABI is actually within the downloaded Android source code which is pulled in via repo, all my android source is within ~/mydroid.

If you are building from the master tree, ignore this bit, but if you are building from Froyo (you passed -b froyo to repo before syncing) then in the android folder (where you issue make, etc etc) make sure you have edited the file build/core/main.mk, go to line 104:

Replace:

# Check for the correct version of java
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
ifeq ($(strip $(java_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
$(info The correct version is: 1.5.)
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
$(info ************************************************************)
$(error stop)
endif

# Check for the correct version of javac
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
ifeq ($(strip $(javac_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of javac.)
$(info $(space))
$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
$(info The correct version is: 1.5.)
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
$(info ************************************************************)
$(error stop)
endif

with:

# Check for the correct version of java
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
ifeq ($(strip $(java_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
$(info The correct version is: 1.6.)
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
$(info ************************************************************)
$(error stop)
endif

# Check for the correct version of javac
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
ifeq ($(strip $(javac_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of javac.)
$(info $(space))
$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
$(info The correct version is: 1.6.)
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)http://source.android.com/download)
$(info ************************************************************)
$(error stop)
endif