Java – how to fix the JDK not found error when building Android source?

I'm trying to build Android source by the steps provided here. But my JDK is in trouble. When publishing:

lunch full-eng

I received 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 try to install JDK correctly through the following steps:

Step 1

Uninstall following these steps. All related Java

Step 2

Install the correct Java before following these steps. I used the default installer option and version 6 instead of 7 or 8

Step 3

I'm just following this answer

sudo gedit .bashrc

Edit the file at the bottom by adding these 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 have 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

Enter the 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

Enter the 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's missing? What about "permission denied"?

resolvent:

I have the same problem. I got it and solved it. I changed the file permissions of the entire Android source code folder:

sudo chmod 755 -R ~/Android

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>