1

In a Cordova (11.0.0) project, when building for the Android ("cordova-android": "^10.1.2") platform, I'm getting this error from gradle(7.4.2): 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.

According to this answer and this answer it's related to Java 18 and the issue can be fixed by adding some properties to gradle.properties.

The file requiring editing is platforms/android/gradle.properties and it is recommended that this file is modified using the before_build hook script.

I have done that and confirmed that my script correctly copies my version of gradle.properties. However something is subsequently overwriting that with the default version of the file.

How do I prevent my version of the file being overwritten by the default version?

glennr
  • 2,069
  • 2
  • 26
  • 37
  • For anyone who found this question because of the Java error. Solving that issue just reveals further Java and Gradle version related issues and the only way I could fix that was by reverting to a previous java version. I had to go back to Java 15. – glennr Sep 15 '22 at 21:09

0 Answers0