[Solved] 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 @195ff383

2024/01/19 15:57

Error

What went wrong:
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 @195ff383

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 15s
Exception: Gradle task assembleDebug failed with exit code 1

Tryied

1 change gradle version to : 6.7-all: distributionUrl=file:///E:/app-dev/gradle/gradle-6.7-all.zip

It shows error again. Then I changed it to 7.4-all

Solution

Change the following code in your Android configuration file.

distributionUrl=file:///E:/app-dev/gradle/gradle-8.0.2-all.zip

buildscript {
ext.kotlin_version = ‘1.7.0’
repositories {
maven { url ‘https://maven.aliyun.com/nexus/content/groups/public/’ }
maven { url ‘https://maven.aliyun.com/repository/central’ }
maven { url ‘https://maven.aliyun.com/repository/public’ }
maven { url ‘https://maven.aliyun.com/repository/google’ }
maven { url ‘https://maven.aliyun.com/repository/gradle-plugin’ }
}

dependencies {
classpath ‘com.android.tools.build:gradle:7.4.2’
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
}
}

Leave a Reply

Back to top