我正在尝试按照此处提供的步骤构建 Android 源代码。但是我的JDK有问题。启动时:
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?
所以我尝试通过以下步骤正确安装JDK:
步骤1
按照以下步骤卸载所有与 JAVA 相关的内容。
第2步
按照以下步骤安装正确的 JAVA 。我使用了默认安装选项和版本 6,而不是 7 或 8
第 3 步
在这里,我只是按照这个答案。
sudo gedit .bashrc
通过添加这些行来编辑底部的文件
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
第4步
测试我到目前为止所做的事情:
...:~$ 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
第 5 步
进入终端到Android源文件夹并输入
source build/envsetup.sh
结果:
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
第 6 步
进入终端到Android源文件夹并输入
lunch full-eng
结果:
.../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?
我做错了什么?什么不见了?“权限被拒绝”怎么办?