相关报错1
Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.0. Cannot sync the project.
We recommend upgrading to Gradle version 8.9.
The minimum compatible Gradle version is 8.5.
The maximum compatible Gradle JVM version is 19.
Possible solutions:
- Upgrade to Gradle 8.9 and re-sync
- Upgrade to Gradle 8.5 and re-sync
相关报错2
Could not open cp_init generic class cache for initialization script ‘C:\Users\admin\AppData\Local\Temp\sync.studio.tooling9.gradle’ (C:\Users\admin.gradle\caches\8.0\scripts\affkuuvsukx4fc2a5mih59fkp).
BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript’ Unsupported class file major version 65
Android studio从2024.1.1升级到2024.2.1 会自动把Gradle的Java版本指向当前Android studio匹配的版本。
在 Android Studio 中检查 Gradle 的 Java 设置:
- 打开 File > Settings(或 Preferences)。
- 在 Build, Execution, Deployment > Build Tools > Gradle 下检查Java版本是不是你当前安装的,如果不是改一下就可以