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

rhfm7lfc  于 2023-01-31  发布在  Android
关注(0)|答案(1)|浏览(215)

我在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

我使用的OpenJDK版本来自http://jdk.java.net/java-se-ri/10
我的JDK目录路径如下:JDK path
当我在项目结构窗口中切换回1.8(选中“Use embedded JDK”)时,一切都运行良好。
谢谢你的建议。

rwqw0loc

rwqw0loc1#

这是一个插件问题。请从here下载Android Studio Canary构建版本。

下载最新的IntelliJ版本。

  • 将build.gradle中的类路径更新为:“com.android.tools.build:分级版本:7.0.0-α 12”
  • 将构建工具版本更新为:“31.0.0版本2”
  • 将SDK版本更新为:30

我建议你选第二个。

相关问题