[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 @fb04536]
3 Answers
For me what worked was to uninstall all manually installed java versions I mean java installations via installer, or let's say uninstall all java installations at /Library/Java/JavaVirtualMachines/.
- run
/usr/libexec/java_home -v 1.8.0_06 --exec javac -versionto see all currently installed java versions. - run
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdkon each of the jdk versions. - Check the JDK location in Android Studio, you can find that under
Android Studio > Preferences > Build, Execution, Deployment > Build Tools > Gradlemake sure whatever JDK is selected is at the location/Applications/Android Studio.app/Contents/jre/Contents/Home, this is Android Studio's downloaded JDK location, if you can't find the JDK you want to use in the dropdown of downloaded JDKs, use the download JDK button in the dropdown. - try running the application again it should now use the JDK set by android studio.
Comments
If you are working with flutter, I just figured out the solution All I did is to add
org.gradle.jvmargs=--add-opens java.base/java.io=ALL-UNNAMED
to the gradle.properties file
See this link : How to solve InaccessibleObjectException ("Unable to make {member} accessible: module {A} does not 'opens {package}' to {B}") on Java 9?
Comments
If you are working with Android(Java),try lowering the JDK version to 11 or 8(JDK 1.8)
1 Comment
Lukas Körfer
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review