Capacitor Migration 5.0.0 Failing on Android

I am currently on Capacitor v4.0.0

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 = 8.0.0.
[info] Set = 4.3.15.
✔ Migrating build.gradle file. in 22.38ms
✔ Remove android.enableJetifier=true from in 1.44ms
[error] Unable to update Android Manifest. Missing <activity> tag
✔ Migrating package from Manifest to build.gradle in 2.75ms
✔ Migrating 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 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 for more information.

I have tried updating the namespace in the build.gradle with no luck. What am I doing wrong?

please don’t cross-post.

My answer here:

can you share your AndroidManifest.xml?

Here is my AndroidManifest.xml

<?xml version="1.0" encoding="utf-8" ?>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />


    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

This is a bug in the migration command that doesn’t find the package if it’s in a different like than the manifest.

Have you tried using AGP Upgrade Assistant as the error is telling you?

Yes, when I use AGP the namespace error occurs with the build.gradle. I can’t get past that part

That error will also appear if any of your plugins haven’t moved the package to the build.gradle yet.

Is there any fix for that?

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?

I have the same same problem.

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.


Great after few file/directory permissions fixing i was able to build

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

Same setup here. Any advice for getting rid of the “Namespace not specified” error would be appreciated.

Same thing here. Upgraded CLI, built and synced, still not working on Android. It gives the same error.