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?