capacitor: [Android Studio] Errors after Capacitor update in Android Studio
[X] I would to submit a bug or support question
Current behavior
I’m not sure if it’s a bug or just something I should ignore, but each time I update capacitor
in my existing test project, build, copy and then open Android Studio
I face the following errors (first error popup straight after Android Studio open, the other one after automatic build)
16.03.18 15:02 Unsupported Modules Detected: Compilation is not supported for following modules: assets-capacitor-android-plugins~1, capacitor-android-plugins. Unfortunately you can’t have non-Gradle Java modules and Android-Gradle modules in one project.
15:02 Unsupported Modules Detected: Compilation is not supported for following modules: assets-capacitor-android-plugins~1, capacitor-android-plugins. Unfortunately you can’t have non-Gradle Java modules and Android-Gradle modules in one project.
15:02 Unregistered VCS root detected The directory /Users/me/Documents/projects/lab/capacitor-camera is under Git, but is not registered in the Settings. Add root Configure Ignore
15:03 Gradle sync started
15:03 Error Loading Project: Cannot load module assets-capacitor-android-plugins Details…
15:03 Platform and Plugin Updates: The following components are ready to update: Android Emulator, Google Play services
15:03 Project setup started
15:03 Gradle sync failed: java.lang.NullPointerException (41s 709ms)

Expected behavior
No error I guess, but like I said, maybe I do something wrong
Current way to solve this
To solve this, each time I remove the “platform”
rm -r android
and then add it again
npx cap add android
npx cap sync
npx cap open android
Steps to reproduce
npm remove --save @capacitor/core @capacitor/cli
npm install --save @capacitor/core @capacitor/cli
ionic build --prod
npx cap copy
npx cap open android
p.s.: all the above steps are successful and produce no errors
Others informations
Gradle 4.6
Groovy: 2.4.12 Ant: Apache Ant™ version 1.9.9 compiled on February 2 2017 JVM: 1.8.0_60 (Oracle Corporation 25.60-b23) OS: Mac OS X 10.12.6 x86_64
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 46 (17 by maintainers)
@SergioSuarezDev @krithikuntukad , i solved this issue by sync the project ( File -> Sync Project with gradle files) Hope it will help
None of the recommended solutions worked for me. Removing the /android/.idea folder did the job
Faced the issue, again.
Neither “Invalidate Caches / Restart” nor “Sync Project with gradle files” solved the problem, after each restart I still faced the issue.
Add no other choice than delete (
rm -r android
) and add (npx cap add android
) the android project to clean it and “solve” the issue.There’s another way I’ve found to fix it, File -> Invalidate Caches / Restart -> Invalidate and Restart
@mlynch Any chance this could be reopened? It seems simple to reproduce with the latest versions of everything:
Unsupported Modules Detected: Compilation is not supported for following modules: capacitor-cordova-android-plugins, android-capacitor-cordova-android-plugins. Unfortunately you can’t have non-Gradle Java modules and Android-Gradle modules in one project.
This just keeps… coming… back. Anyone else keep having this issue over and over again? If so, how did you solve it?
Removing the /android/.idea folder helped me 😃
Same here. I didn’t remove
android
but even with the error shown by Android Studio saying that you cannot compile the project, I hitBuild > Build Bundle(s) / APK(s) > Build APK(s)
and it worked (and that’s what I wanted)I am still getting this error. Tried all recommended solution.
I’m getting the error too. Trying to run a Vue Ionic app using ‘npm run build:android’ which just packages the npx stages.
“build:android”: “npm run build; npx cap sync android; npx cap open android”
I’m getting this error too @mlynch so maybe this should be re-opened.