Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter application on Android `private final java.lang.String java.io.File.path`

I was facing some issue, with my flutter app. And after upgrading the Gradle version I started facing this issue. And i couldn't find anything close to this, after googling. But later I solved it from a different issue. SO I decided to create a issue for someone who's looking up this same issue.

Bcz I had no idea what to try. I was almost lost.

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 @36297cd9
like image 917
Hippo Fish Avatar asked Jun 15 '26 09:06

Hippo Fish


1 Answers

To solve the issue, you have to add this line to your gradle.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

And your grade.properties file should look something like this -> enter image description here

For me, it solved the issue. And then I had a different issue. But for that I just updated my kotlin version inside android/build.gradle file. And then, finally my project ran.

If anyone knows this issue in depth, and wants to explain the situation a bit more, I would really appreciate it. Thank you 😊💚

like image 174
Hippo Fish Avatar answered Jun 17 '26 00:06

Hippo Fish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!