gpt4 book ai didi

java - 构建 Android 源代码时如何修复 JDK 未找到错误?

转载 作者:太空宇宙 更新时间:2023-11-03 11:33:27 24 4
gpt4 key购买 nike

我正在尝试构建 Android source by the steps provided here.但是我的 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:


第一步

卸载与 following these steps. 相关的所有 JAVA

第 2 步

通过 following these steps 安装正确的 JAVA .我使用了默认安装程序选项和版本 6,而不是 7 或 8

第 3 步

我在这里很简单following this answer.

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

第四步

测试到目前为止我做了什么:

...:~$ 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?

我做错了什么?什么东西少了? “权限被拒绝”怎么办?

最佳答案

我遇到了同样的问题。我通过更改整个 android 源代码文件夹的文件权限解决了这个问题:

sudo chmod 755 -R ~/Android

关于java - 构建 Android 源代码时如何修复 JDK 未找到错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17988110/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com