How do I fix JDK not found error when building Android source?
android, android-source, java, ubuntu
Solution
I found the solution:
For some reason I did not have the respective rights as the "Permission denied" would suggest. Setting the permissions for the Android source folder via chmod did the trick
I mistakenly downloaded the latest branch. However I only have a 32 bit system. For 32 bit you can only use Android source that is smaller than Android 2.3 and for those versions you also have to use JDK 5 http://source.android.com/source/building.html
Problem
I am trying to build the Android source by the steps provided here. However I have troubles with my JDK. When launching: ``` lunch full-eng ``` I get the following error: ``` /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: Permission denied /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: Permission denied /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: Permission denied /bin/bash: build/core/find-jdk-tools-jar.sh: Permission denied build/core/config.mk:344: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop. ** Don't have a product spec for: 'full' ** Do you have the right repo manifest? ``` So I tried to install the JDK correctly by the following steps: Step 1 Uninstall everything JAVA related by following these steps. Step 2 Install correct JAVA by following these steps. I used the default installer option and version 6, not 7 or 8 Step 3 Here I am simply following this answer. ``` sudo gedit .bashrc ``` Edit the file at the bottom by adding those lines ``` JAVA_HOME=/usr/lib/jvm/java-6-oracle export JAVA_HOME # replacing /path/to/androidsdk/ with correct path of course.. export PATH=${PATH}:/path/to/androidsdk/android-sdk-linux/platform-tools PATH=$PATH:$JAVA_HOME # Variable ANDROID_JAVA_HOME ANDROID_JAVA_HOME=/usr/lib/jvm/java-6-oracle export ANDROID_JAVA_HOME PATH=$PATH:$ANDROID_JAVA_HOME ``` Step 4 Test what I've done so far: ``` ...:~$ echo $JAVA_HOME /usr/lib/jvm/java-6-oracle ...:~$ java -version java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) Server VM (build 20.45-b01, mixed mode) ...:~$ which java /usr/bin/java ...:~$ echo $ANDROID_JAVA_HOME /usr/lib/jvm/java-6-oracle ...:~$ echo $PATH /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-oracle/bin:/usr/lib/jvm/java-6-oracle/db/bin:/usr/lib/jvm/java-6-oracle/jre/bin:/path/to/androidsdk/android-sdk-linux/platform-tools:/usr/lib/jvm/java-6-oracle ``` Step 5 Go in terminal to the Android source folder and enter ``` source build/envsetup.sh ``` Result: ``` including device/asus/grouper/vendorsetup.sh including device/asus/tilapia/vendorsetup.sh including device/generic/armv7-a-neon/vendorsetup.sh including device/generic/armv7-a/vendorsetup.sh including device/generic/mips/vendorsetup.sh including device/generic/x86/vendorsetup.sh including device/lge/mako/vendorsetup.sh including device/samsung/maguro/vendorsetup.sh including device/samsung/manta/vendorsetup.sh including device/samsung_slsi/arndale/vendorsetup.sh including device/samsung/toroplus/vendorsetup.sh including device/samsung/toro/vendorsetup.sh including device/ti/panda/vendorsetup.sh ``` Step 6 Go in terminal to the Android source folder and enter ``` lunch full-eng ``` Result: ``` .../androidsource$ lunch full-eng /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: Permission denied /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: Permission denied /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: Permission denied /bin/bash: build/core/find-jdk-tools-jar.sh: Permission denied build/core/config.mk:344: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop. ** Don't have a product spec for: 'full' ** Do you have the right repo manifest? ``` What did I do wrong? What is missing? What about the "Permission denied"?