When I upgrade using the official migration guide, I run into issues on Android.
When I run npx cap migrate, my console shows this:
[error] npm install failed. Try deleting node_modules folder and running npm install --force manually.
✔ Update App Icon to only 1024 x 1024 in 2.50ms
✔ Remove Podfile.lock from iOS .gitignore in 1.46ms
[info] Set com.android.tools.build:gradle = 8.0.0.
[info] Set com.google.gms:google-services = 4.3.15.
✔ Migrating build.gradle file. in 22.38ms
✔ Remove android.enableJetifier=true from gradle.properties in 1.44ms
[error] Unable to update Android Manifest. Missing <activity> tag
✔ Migrating package from Manifest to build.gradle in 2.75ms
✔ Migrating gradle-wrapper.properties by updating gradle version to 8.0.2. in 326.42μs
✔ Migrating variables.gradle file. in 3.55ms
✔ Running cap sync. in 8.55s
✖ Upgrading gradle wrapper files - failed!
[error] gradle wrapper files were not updated
[info] IMPORTANT: Review https://capacitorjs.com/docs/next/updating/5-0#plugins for breaking changes in these plugins
that you use: @capacitor/camera, @capacitor/local-notifications.
✔ Writing breaking changes. in 2.53ms
[success] Migration to Capacitor 5.0.0 is complete. Run and test your app!
iOS builds ok, but when I open Android Studio I am greeted with this error:
Namespace not specified. Please specify a namespace in the module's build.gradle file like so:
android {
namespace 'com.example.namespace'
}
If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
I have tried updating the namespace in the build.gradle with no luck. What am I doing wrong?
Well I am completely stuck. I upgraded Android studio like the migration suggested, now my previous build won’t work, and I can’t upgrade to Capacitor v5. Would anyone be able to hop on a quick call with me?
Capacitor CLI 5.0.2, released yesterday, will patch any plugin that has not done the package migration from AndroidManifest.xml to build.gradle so you don’t need to wait for plugin maintainers to update their plugins.
Im on Capacitor 5.0.3 and Capacitor CLI 5.0.3 and gradle 8.0.1. Everything is updated. I’ve removed the build folder. I’m still getting the “Namespace not specified” error. What to do or double check?
Hard to tell without a sample app, @capacitor/cli 5.0.3 should patch any plugin that has not moved their package to the build.gradle, but maybe it’s not a Capacitor plugin what’s causing your issue.
Can you provide your package.json?
Would be better if you create your own forum question
I have exact same problem, in my case when I update @capacitor/cli to the latest version(don’t know why but it still remained as old version in package.json) and sync gradle => then it resolved.
I had the same issue. This is what I did to solve it:
In my package.json I changed from the dependencies all @capacitor/XXX to the latest version which for now is 5.XX and on devDependencies I changed the @capacitor/cli to the latest version which is 5.5.0 right now.
deleted the android folder
npx cap add android
npx cap open android
gradle build was fine and I can run my app on an android device.