Grade sync failed: Unable to make field private static final java.util.Map java.lang.ProcessEnvironment.theCaseInsensitiveEnvironment accessible

Viewed 5419

I try to build my gradle project and I get the following error:

1:36 PM Gradle sync failed: Unable to make field private static final java.util.Map java.lang.ProcessEnvironment.theCaseInsensitiveEnvironment accessible: module java.base does not "opens java.lang" to unnamed module @7d417077 (5 s 556 ms)

build.gradle file

and no, I do not know gradle and no I am not planning on learning it, but I have no chioce. Thanks in advance

2 Answers

I've had a similar problem with an old BungeeCord plugin, which used Gradle 4.10. In my case - it seems like that old Gradle doesn't work properly with Java 16, so I've manually changed contents of gradle/wrapper/gradle-wrapper.properties file to use Gradle 7.0.

Old file:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip

New file:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip

Now it works ok, no more Gradle errors.

It seems like it can be cause by different things.

I solved it changing the JDK to the embedded android JDK and adding it to the path and JAVA_HOME environement variables.

Related