I am working on a android project which has older Java version when i run my app in android studio. this error occurs:
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 @2f9fb583
Helpfull to me specially ❣️ thanks a lot.
Based on the error message, you should add exports for the
com.sun.tools.javac.tree
package within thejdk.compiler
module. Here’s how you can update yourgradle.properties
file: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 \
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
Check this for more information: https://www.communityforum.in/question/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/