close

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

Hello Guys, How are you all? Hope You all Are Fine. Today Every time I try to run and build I get the following error message accessible: module java.base does not “opens java.io” to unnamed modulein java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

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

Today Every time I try to run and build I get the following error message.

Unable to make field private final java.lang.String java.io.File.path accessible:
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 @42760a00

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

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

    To Solve accessible: module java.base does not “opens java.io” to unnamed module Error Just downgrade JDK 16 to JDK 15 Solved my error. second solution is Basically Download JDK 8 (1.8) and install it. change environment variable (write JDK 8 path to environment variable) Then change your project structure and write JDK 8 path to JDK location. invalidate caches and restart android studio. build your project and it should work.

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

    To Solve accessible: module java.base does not “opens java.io” to unnamed module Error Just downgrade JDK 16 to JDK 15 Solved my error. second solution is Basically Download JDK 8 (1.8) and install it. change environment variable (write JDK 8 path to environment variable) Then change your project structure and write JDK 8 path to JDK location. invalidate caches and restart android studio. build your project and it should work.

Solution 1: Downgrade JDK to JDK 15

Just downgrade JDK 16 to JDK 15 Solved my error.

Solution 2 : Downgrade to JDK 8

  1. Basically Download JDK 8 (1.8) and install it.
  2. change environment variable (write JDK 8 path to environment variable)
  3. Then change your project structure and write JDK 8 path to JDK location.
  4. invalidate caches and restart android studio.
  5. build your project and it should work.

Solution 3: Change gradle version

You Just need to change gradle version in gradle-wrapper properties to 7.1.1 and then add this 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

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment