Gradle同步完成后,Android Studio 3.6显示以下警告:
15:51 Gradle sync finished in 27 s 97 ms
15:51 Android Studio is using the following JDK location when running Gradle:
/home/azabost/java/jdk8u252-b09
Using different JDK locations on different processes might cause Gradle to
spawn multiple daemons, for example, by executing Gradle tasks from a terminal
while using Android Studio.
我不知道为什么看到它以及它是否有意义。项目正常构建,没有任何问题。我使用的是全新的Ubuntu系统,在其中我将AdoptOpenJDK安装到/home/azabost/java/jdk8u252-b09
,将Android Studio 3.6安装到/home/azabost/bin/android-studio-3.6
。我导出了几个与JDK相关的路径:JAVA_HOME
,JDK_HOME
和STUDIO_JDK
,以确保Android Studio可以正确提取我的JDK。以下是一些显示正确的JDK位置的命令的输出:
$ which java
/home/azabost/java/jdk8u252-b09/bin/java
$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)
$ export | grep java
JAVA_HOME=/home/azabost/java/jdk8u252-b09
JDK_HOME=/home/azabost/java/jdk8u252-b09
PATH=/home/azabost/bin:/home/azabost/java/jdk8u252-b09/bin:/home/azabost/bin/android-sdk/platform-tools:/home/azabost/bin/android-sdk/emulator:/home/azabost/bin/android-sdk/cmdline-tools/latest/bin:/home/azabost/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
STUDIO_JDK=/home/azabost/java/jdk8u252-b09
./gradlew --version
------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------
Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_252 (AdoptOpenJDK 25.252-b09)
OS: Linux 5.4.0-28-generic amd64
当我在Android Studio中打开“项目结构”对话框时,可以看到已设置正确的JDK。但是,当我单击下拉菜单选择其他JDK时,我会看到一些奇怪的东西。有2个选项:
因此,嵌入式JDK列出了两次,其中包括带有“ JAVA_HOME”描述的描述,这很奇怪,因为正如您所看到的,我的JAVA_HOME
变量指向另一个JDK。
我不确定这个特定的列表问题是否与我看到的警告有关。
这是我在~/.AndroidStudio3.6/config/options/jdk.table.xml
文件中看到的:
cat ~/.AndroidStudio3.6/config/options/jdk.table.xml
<application>
<component name="ProjectJdkTable">
<jdk version="2">
<name value="1.8" />
<type value="JavaSDK" />
<version value="java version "1.8.0_252"" />
<homePath value="$USER_HOME$/java/jdk8u252-b09" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/plugins/java/lib/jdkAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/charsets.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/cldrdata.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/dnsns.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/jaccess.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/localedata.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/nashorn.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/sunec.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/sunjce_provider.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/sunpkcs11.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/ext/zipfs.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/jce.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/jsse.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/management-agent.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/resources.jar!/" type="simple" />
<root url="jar://$USER_HOME$/java/jdk8u252-b09/jre/lib/rt.jar!/" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite">
<root url="jar://$USER_HOME$/java/jdk8u252-b09/src.zip!/" type="simple" />
</root>
</sourcePath>
</roots>
<additional />
</jdk>
<jdk version="2">
<name value="Android API 29 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_252"" />
<homePath value="$USER_HOME$/bin/android-sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/plugins/android/lib/androidAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/bin/android-sdk/platforms/android-29/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/bin/android-sdk/platforms/android-29/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite">
<root url="file://$USER_HOME$/bin/android-sdk/sources/android-29" type="simple" />
</root>
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-29" />
</jdk>
<jdk version="2">
<name value="Kotlin SDK" />
<type value="KotlinSDK" />
<homePath value="$KOTLIN_BUNDLED$" />
<roots>
<annotationsPath>
<root type="composite" />
</annotationsPath>
<classPath>
<root type="composite" />
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional />
</jdk>
<jdk version="2">
<name value="1.8 (2)" />
<type value="JavaSDK" />
<version value="java version "1.8.0_212"" />
<homePath value="$APPLICATION_HOME_DIR$/jre" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/plugins/java/lib/jdkAnnotations.jar!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/charsets.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/cldrdata.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/dnsns.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/jaccess.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/localedata.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/nashorn.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/sunec.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/sunjce_provider.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/sunpkcs11.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/ext/zipfs.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/jce.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/jsse.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/management-agent.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/resources.jar!/" type="simple" />
<root url="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/rt.jar!/" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root url="https://docs.oracle.com/javase/8/docs/api/" type="simple" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional />
</jdk>
<jdk version="2">
<name value="Android API 28 Platform" />
<type value="Android SDK" />
<version value="java version "1.8.0_212"" />
<homePath value="$USER_HOME$/bin/android-sdk" />
<roots>
<annotationsPath>
<root type="composite">
<root url="jar://$USER_HOME$/bin/android-sdk/platforms/android-28/data/annotations.zip!/" type="simple" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root url="jar://$USER_HOME$/bin/android-sdk/platforms/android-28/android.jar!/" type="simple" />
<root url="file://$USER_HOME$/bin/android-sdk/platforms/android-28/data/res" type="simple" />
</root>
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite">
<root url="file://$USER_HOME$/bin/android-sdk/sources/android-28" type="simple" />
</root>
</sourcePath>
</roots>
<additional jdk="1.8 (2)" sdk="android-28" />
</jdk>
</component>
</application>%
根据ps -x
,使用嵌入式JDK启动的Android Studio:
ps -x | grep studio
28805 ? S 0:00 /bin/sh /home/azabost/bin/android-studio-3.6/bin/studio.sh
28908 ? Sl 5:06 /home/azabost/bin/android-studio-3.6/jre/bin/java -classpath /home/azabost/bin/android-studio-3.6/lib/bootstrap.jar:/home/azabost/bin/android-studio-3.6/lib/extensions.jar:/home/azabost/bin/android-studio-3.6/lib/util.jar:/home/azabost/bin/android-studio-3.6/lib/jdom.jar:/home/azabost/bin/android-studio-3.6/lib/log4j.jar:/home/azabost/bin/android-studio-3.6/lib/trove4j.jar:/home/azabost/bin/android-studio-3.6/lib/jna.jar:/home/azabost/bin/android-studio-3.6/jre/lib/tools.jar -Xms256m -Xmx1280m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -Dsun.io.useCanonPrefixCache=false -Djava.net.preferIPv4Stack=true -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true -Djna.nosys=true -Djna.boot.library.path= -da -Dawt.useSystemAAFontSettings=lcd -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine -Dsun.tools.attach.tmp.only=true -Xmx3072m -XX:ErrorFile=/home/azabost/java_error_in_STUDIO_%p.log -XX:HeapDumpPath=/home/azabost/java_error_in_STUDIO.hprof -Didea.paths.selector=AndroidStudio3.6 -Djb.vmOptionsFile=/home/azabost/bin/android-studio-3.6/bin/studio64.vmoptions,/home/azabost/.AndroidStudio3.6/config/studio64.vmoptions -Didea.platform.prefix=AndroidStudio -Didea.jre.check=true com.intellij.idea.Main
答案 0 :(得分:0)
该错误清楚地表明您已在java目录中安装了android studio。俗话说改变了位置。您可以提供其他驱动器路径来安装Studio。从1.8 https://www.oracle.com/in/java/technologies/javase-downloads.html下载Java的升级版本 还可以从现有目录更改路径。