I have already tried this:
deleting android project and adding it again,
manual migration modifying package.lock
migration using ionic plugin “Ionic v1.9.4” through recomendations section
that happens when some of your plugins are still using an old version of gradle/gradle plugin, or you didn’t update gradle/gradle plugin in your app.
How did you migrate to capacitor 4? manually? vs extension? migrate command?
what’s your capacitor plugins list?
I’m running into this exact same issue. The errors are happening in the capacitor-android module itself. I upgraded “manually”, by updating all @capacitor-related dependencies.
For me, the issue was that I overlooked the @capacitor/cli dependency. After I updated that dependency to ~4.2.0, and then deleted the /android folder (rm -rf android), and re-added it (npx cap add android) it works!
We had the same problem. Upgraded to cap 4 via the migration tool and everything went smoothly for ios. on android that’s where it started to blow up.
We are still using cordova plugins and the majority of them need to be updated to support the new stuff. Checked a few repos of the problematic plugins and they are all out of date (3+ years old). Some have fixes from members but the plugin developers themselves have not merged those fixes or don’t intend to.
So we have 2 options:
Remove those cordova plugins and switch over to the capacitor version which would take some time.
Hold off on upgrading to cap 4 until 2 weeks before mandatory update.
We decided to go with option 2. There is still 2 whole months to give the plugin owners time to update.