I am trying to run my android program in Qt however I am getting the following error:
Execution failed for task ':processDebugManifest'.
> 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 @13d72a22
I tried different versions of jdk and gradle however nothing helps.
Gradle version: 7.4.2
JDK version: 18
3
Answers
Adding
--add-opens=java.base/java.io=ALL-UNNAMED
to yourJAVA_OPTS
environment variable or theorg.gradle.jvmargs
gradle property will resolve this issue with Java 18.Here is the full
org.gradle.jvmargs
gradle property value that I’m using:Another option is to downgrade to JDK 17. I downgraded to openjdk version "17.0.3" 2022-04-19 and did not get the error.
I got this weird error in IntelliJ when trying to build an Android project. I think the core reason was me changing the JDK version that Gradle uses in Settings -> Build, Execution, Deployment -> Build Tools -> Gradle and Gradle JVM down there at the bottom. I tried increasing that to fix something else and got this error. Just changing back to the exact version I always used seemed to fix it. This is kind of a terrible answer but I’m going to post it anyway, it might help someone.
Answer for Flutter Devs
I ran into this error in IntelliJ while trying to build a Flutter app for Android. I was updating an app I had worked on almost a year ago so the
com.android.tools.build:gradle
dependency in android/build.gradle was way out of date.Fixed by changing dependency to this: