Fail to migrate v5 to v6

Hi! I am following this tutorial to migrate v5 to v6. When using npx cap migrate, I received the following error:

√ Migrating build.gradle file. in 2.66ms
√ Replacing deprecated compileSdkVersion from build.gradle in 723.00μs
× Migrating variables.gradle file. - failed!
[error] Failed to migrate: TypeError: Invalid Version: ext {
        minSdkVersion = 22
        compileSdkVersion = 34
        targetSdkVersion = 34
        androidxActivityVersion = '

Has anyone encounter this issue before? Thank you.

2 Likes

can you paste your variables.gradle file?

1 Like

I got the same error with a variable.gradle as follow :

ext {
    minSdkVersion = 22
    compileSdkVersion = 34
    targetSdkVersion = 34
    androidxActivityVersion = '1.7.0'
    androidxAppCompatVersion = '1.6.1'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.10.0'
    androidxFragmentVersion = '1.5.6'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.5'
    androidxEspressoCoreVersion = '3.5.1'
    cordovaAndroidVersion = '10.1.1'
    coreSplashScreenVersion = '1.0.0'
    androidxWebkitVersion = '1.6.1'
}
1 Like

what’s your node/npm versions and operating system?

I’m using node 20.2.0 and npm 10.1.0

I finally suceed the migration following thoses steps :

the migration looks successful

1 Like

ext {
minSdkVersion = 22
compileSdkVersion = 33
targetSdkVersion = 33
androidxActivityVersion = ‘1.7.0’
androidxAppCompatVersion = ‘1.6.1’
androidxCoordinatorLayoutVersion = ‘1.2.0’
androidxCoreVersion = ‘1.10.0’
androidxFragmentVersion = ‘1.5.6’
coreSplashScreenVersion = ‘1.0.0’
androidxWebkitVersion = ‘1.6.1’
junitVersion = ‘4.13.2’
androidxJunitVersion = ‘1.1.5’
androidxEspressoCoreVersion = ‘3.5.1’
cordovaAndroidVersion = ‘10.1.1’
firebaseMessagingVersion = ‘23.1.2’
playServicesLocationVersion = ‘21.0.1’
firebaseAnalyticsVersion = ‘21.2.2’
firebaseCrashlyticsVersion = ‘18.6.2’
androidxExifInterfaceVersion = ‘1.3.6’
androidxMaterialVersion = ‘1.8.0’
}facing same issue this is my variables.gradle. I tried updating it to latest file shown on Updating to 6.0 | Capacitor Documentation still getting same error.

Can you put it in a code block so it can be copy/pasted as is? if introducing it as text the quotes are converted and are not valid for gradle files.

Also, can you answer the questions about the operating system and node/npm versions?

1 Like