After updating my app to use Capacitor 3, I’m running into a problem with the new
run command. It’s failing at the end, so I’m not able to debug my app on an android device at all until I resolve this.
Here is the main error message I get after running
ionic cap sync and subsequently
ionic cap run, then selecting “android”:
[capacitor] [capacitor] FAILURE: Build failed with an exception. [capacitor] [capacitor] * What went wrong: [capacitor] Execution failed for task ':app:processDebugMainManifest'. [capacitor] > Task :capacitor-app:generateDebugRFile [capacitor] > Task :app:processDebugMainManifest FAILED [capacitor] > 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 @22738b3d [capacitor]
(full error message below)
I’ve looked online to see what this error means, but there doesn’t seem to be a clear answer. As far as I can tell, this problem seems to arise in processing the app’s Android Manifest file (which I’ve posted below also), but most of the questions mention that it could be something related to the minSdkVersion, or a duplicate element, or that it’s some problem with cordova on an old ionic version. I tried some applicable potential solutions, but none seemed to work.
I had also tried to create a fresh Ionic app to see if the problem localized to my app, but it seems like it isn’t, as I get the same error on the blank app. So it makes sense that this isn’t a problem with my app, but rather with something related to the build tools, maybe a version issue with Gradle, etc.
However, compiling my app in Android Studio works, so I don’t think it is a Gradle problem either, though I assume it could possibly be something else that capacitor depends on. Here’s my system/version info, for reference:
|Java||jdk v16.0.1 2021-04-20|
Here’s a Github repo of the fresh app I used, if anyone wants to take a look. It’s just a blank vue tabs app. The full console output and Android Manifest file are posted there, as they exceed this post’s character limit.
I can’t seem to figure out where the problem is, so if anyone has any suggestions, that’d be much appreciated. Maybe if anyone is able to run
ionic cap run on a blank Vue app successfully, you could share what version of Java/Ionic/Gradle, etc. you are using, so I can also install the same versions?