当前位置: 首页 > 知识库问答 >
问题:

Android Studio给出关于JDK位置的警告

蓝鸿哲
2023-03-14

Android Studio 3.6在Gradle同步完成后显示以下警告:

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_homejdk_homestudio_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中打开Project Stucture对话框时,我可以看到设置了正确的JDK。但是当我单击下拉菜单选择一个不同的JDK时,我可以看到一些奇怪的东西。有2个选项:

  1. 嵌入式JDK:/home/azabost/bin/android-studio-3.6/jre
  2. java_home:/home/azabost/bin/android-studio-3.6/jre

因此,嵌入式JDK被列出了两次,包括带有“java_home”描述的JDK,这很奇怪,因为正如您所看到的,我的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 &quot;1.8.0_252&quot;" />
      <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 &quot;1.8.0_252&quot;" />
      <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 &quot;1.8.0_212&quot;" />
      <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 &quot;1.8.0_212&quot;" />
      <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-XAndroid Studio推出的嵌入式JDK:

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

共有1个答案

山阳辉
2023-03-14

该错误清楚地说明您已经在java目录中安装了android studio。它的意思是改变地点。U可以给其他驱动器路径安装工作室。从1.8下载升级版本的java https://www.oracle.com/in/java/technologies/javase-downloads.html还可以从现有目录更改路径。

 类似资料:
  • Navicat Monitor 在检测到服务器出现问题时会发出警报。警报有两种类型:“警告”(橙色)和“严重”(红色)。警告警报不会影响服务器的性能,但可能存在问题并需要调查。严重警报则表示发生影响或将影响服务器性能的严重问题,而这些问题需要立即关注。 当引发警报时,它会显示在警报历史记录页面和概览仪表板上,并将发送通知给指定的组成员或特定人员。 你可以为特定实例和组自定义阈值以触发警报,并设置向

  • 我使用的是128位的AES ALgo,带有CBC密码模式加密,下面是代码: 但这给了我一个警告,输出为: 警告:mcrypt_generic_init():密钥大小太大;提供的长度:64,最大:32 /var/www/cipher.php第10行警告:mcrypt_generic_init():密钥大小太大;提供的长度:64,最大:32 /var/www/cipher.php第14行加密:vM/X

  • 我们的应用程序使用Google Fused location API每3分钟接收一次位置更新。位置请求设置如下- 间隔- 最快间隔- 优先级- 在正常运行的场景中,位置更新被正确地接收,并且位置精度相当好(大约20-25米)。 当地图应用程序打开时,它接收到GPS位置,因此我们的应用程序也开始接收位置更新,这些更新基本上来自GPS收发器(我知道这一点,因为随后的位置更新也有速度和高度值)。 当Ma

  • Tweepy刚刚通过PIP安装到我的Python 2.6.6上。

  • 如何找到所有的数字,这些数字小于给定的no,并且这些数字的设置比特数小于给定的no,但无论什么no。举一个例子,假设给定的no是13(二进制中的1101),那么所有生成的no将是12(二进制中的1100),9(二进制中的1001),8(二进制中的1000),5(二进制中的0101),4(二进制中的0100),1(二进制中的0001)。可见,在1100中(设置位位置为2和3,如在给定的1101号中)