Android Studio - 将 JDK 切换到版本 1.10 后出现构建问题

Mer*_*lus 8 java android-studio

我在 Android Studio 中将 JDK 从 1.8 升级到 1.10 后遇到了问题。我也知道,这个问题出现在1.9中。当我构建项目时,出现以下错误:

error: cannot access ViewGroup class file for android.view.ViewGroup not found error: cannot access Activity class file for android.app.Activity not found
error: cannot access ComponentCallbacks class file for android.content.ComponentCallbacks not found
error: cannot access Application class file for android.app.Application not found
error: cannot access DialogInterface class file for android.content.DialogInterface not found
Run Code Online (Sandbox Code Playgroud)

我正在使用http://jdk.java.net/java-se-ri/10中的 OpenJDK 版本

我的JDK目录路径如下: JDK路径

当我在项目结构窗口中切换回 1.8(选中“使用嵌入式 JDK”)时,一切正常。

感谢您的任何建议。

小智 6

是插件问题。从此处下载 Android Studio Canary 版本。

或者

下载最新的 IntelliJ 版本。

  • 将 build.gradle 中的类路径更新为: 'com.android.tools.build:gradle:7.0.0-alpha12'
  • 将构建工具版本更新为:“31.0.0 rc2”
  • 将SDK版本更新为:30

我会说选择第二个选择。