[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(TM) 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
Do you have cordova plugins in your project?
@jcesarmobile to create the project I did "ionic start ..." answered no to "would you like to add iOS/android" and then as described in the doc, as far as I remember, deleted the splash screen plugin
@jcesarmobile to create the project I did "ionic start ..." answered no to "would you like to add iOS/android" and then as described in the doc, as far as I remember, deleted the splash screen plugin
but like I said, it's an existing one (the one I use for my camera tests)
what template did you choose?
@jcesarmobile menu ("hamburger menu top left")
I'm not able to reproduce, but might be related to removing capacitor cli as we write a lot of things there, so after removing it, better run a cap sync or cap update to make sure everything is recreated, specially if you have Cordova or custom plugins.
Same same.
You know what, this problem appears because Android Studio, the very first time I open the project (npx cap open android after having created a fresh new platform like described above) in it, create a folder capacitor-android-plugins with the following manifests/AndroidManifest.xml file in it
<?xml version='1.0' encoding='utf-8'?>
<manifest package='capacitor.android.plugins' xmlns:android='http://schemas.android.com/apk/res/android'>
</manifest>
Then, if I close it and open it again, it will try to compile this and complains.
Does that make sense? Do you also have such a folder/file in your project?

Yeah, I have it and doesn't complain about it
Weird....I'll keep an eye on it. I saw that I "need" to update one or two Android libs, maybe it will help
Maybe it is because the android studio files are committed. I had the same issue. After removing them it was not a problem any longer. I modified the default gitignore to reflect this: https://github.com/ionic-team/capacitor/pull/378
Keeping an eye on this. I haven't run into it myself
cool @JStumpp I'll will keep an eye on it too
if I can't reproduce it anymore, count on me to close the issue
mmmmh I could "still" reproduce the problem after upgrading from alpha25 to alpha31
I tried to remove the git origin (git remote rm origin) but they were none to remove
so I did
npm install --save @capacitor/core @capacitor/cli
ionic build --prod
npx cap sync
npx cap open android
I've left the project for about a week, then when returned faced the same set of errors. I even didn't change anything in it!
npx cap sync or npx cap update didn't make any difference, nor attempts to clear or rebuild project.
Removing and adding android directory again helped, though, none of the tracked by Git files changed, so I assume it is something to do with files listed in .gitignore...
Seems to be unrelated to the android directory at all, since resetting it to defaults doesn't help. However, resetting @capacitor node_modules content does help.
I assume Gradle writes in Capacitor node_modules something that later leads to this issue.
I had the same problem after I've returned to my project and updated the capacitor.
However, invalidating the cache and restarting (File > Invalidate Caches/Restart) did the job. Is that something you've tried?
Closing without more info there's not much we can do here. Try invalidating caches and restarting as recommended above. It's just one of those things you get used to when doing Android development as Android Studio makes mistakes sometimes.
I am still facing the issue
same here