Announcing Capacitor 5.0

Originally published at: Announcing Capacitor 5.0 - Ionic Blog

As Capacitor continues to mature, we’re excited to announce the arrival of the latest version of our powerful, open-source native runtime - Capacitor 5.0.

5 Likes

thank you so much for the amazing job!

1 Like

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 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?

I had the same issue and it was caused by dirty data in android studio

my solution:

-open android studio
-clean build folder
-close android studio

do:
ionic build --prod
npx cap sync
npx cap open android

let android studio update all gradle stuff, libraries etc.

when ready, do your things.

you don’t have to change manually build.gradle

Since version 5.0.2, npx cap migrate patches the build.gradle of plugins that have not been updated to Capacitor 5 to move the package name.

The migrate command failed in the package install step, try running npm install --force manually (or similar command depending on your package manager) after deleting node_modules and the package-lock.json and run npx cap migrate again.

I’m having this problem so I’m keen to see if your steps help but I can’t actually see a clean build folder option in Android Studio - where is it?

I have the same issue (after migrating to Capacitor 5). Did you solve this?