close

[Fixed] accessible: module java.base does not “opens java.io” to unnamed module

Today We are Going To Solve accessible: module java.base does not “opens java.io” to unnamed module in Java. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix accessible: module java.base does not “opens java.io” to unnamed module Error?

  1. How to Fix accessible: module java.base does not “opens java.io” to unnamed module Error?

    To Fix accessible: module java.base does not “opens java.io” to unnamed module Error just Change gradle version. To solve this error you have to just change gradle version in gradle-wrapper properties to 7.1.1. and add the following line in gradle.properties: org.gradle.jvmargs=-Xmx1536M --add exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED

  2. accessible: module java.base does not “opens java.io” to unnamed module

    To Fix accessible: module java.base does not “opens java.io” to unnamed module Error just Replace JDK 16 by JDK 15. Here you have to just replace JDK 16 by JDK 15. And your error will be removed. So just try this method.

Solution 1 : Change gradle version

To solve this error you have to just change gradle version in gradle-wrapper properties to 7.1.1. and add the following line in gradle.properties:

org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED

Solution 2 : Replace JDK 16 by JDK 15

Here you have to just replace JDK 16 by JDK 15. And your error will be removed. So just try this method.

Solution 3 : Change the plugin in the class path

First of all open gradle-wrapper.properties from .\android\gradle\wrapper\ and change the distributionUrl to your required gradle version

distributionUrl = https\://services.gradle.org/distributions/gradle-7.3-all.zip

After it you have to open build.gradle from .\android\build.gradle file and change the plugin in the class path to the one according to your gradle version just like below example:

classpath("com.android.tools.build:gradle:4.2.2") for JDK 6.71+
classpath("com.android.tools.build:gradle:7.0.0") for JDK 7+

And just run npx react-native run-android. It will help you.

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read These Solutions

Leave a Comment