用 AndroidStudio 打开某个工程后,编译报错如下
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @5a056318
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
这个工程在其他人那里是 OK 的,那大概率是 gradle 配置的问题。文章来源:https://www.toymoban.com/news/detail-735393.html
修改 project 的 build.gradle
,gradle 版本改成自己的。文章来源地址https://www.toymoban.com/news/detail-735393.html
buildscript {
repositories {
google()
jcenter()
}
dependencies {
//classpath "com.android.tools.build:gradle:4.1.2"
classpath "com.android.tools.build:gradle:7.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
到了这里,关于AndroidStudio 编译报错Unable to make field private final的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!