I’m trying to migrate our Capacitor version from 2 to 4. After making the necessary upgrades and updates listed on the docs, I’m across the following error. Any ideas?
➜ frontend git:(fix/lean/get-mobile-working) ✗ npx cap run android
✔ Copying web assets from build to android/app/src/main/assets/public in 140.69ms
✔ Creating capacitor.config.json in android/app/src/main/assets in 1.73ms
[info] Found 3 Cordova plugins for android:
@ionic-enterprise/badge@0.8.10
cordova-plugin-ionic@5.4.6
cordova-plugin-whitelist@1.3.4
✔ copy android in 258.43ms
✔ Updating Android plugins in 11.20ms
[info] Found 6 Capacitor plugins for android:
@capacitor/device@4.0.1
@capacitor/haptics@4.0.1
@capacitor/keyboard@4.0.1
@capacitor/network@4.0.1
@capacitor/push-notifications@4.0.1
@capacitor/status-bar@4.0.1
[info] Found 3 Cordova plugins for android:
@ionic-enterprise/badge@0.8.10
cordova-plugin-ionic@5.4.6
cordova-plugin-whitelist@1.3.4
✔ update android in 36.69ms
✔ Please choose a target device: › Pixel 3 API 31 (emulator) (Pixel_3_API_31)
✖ Running Gradle build - failed!
[error]
FAILURE: Build failed with an exception.
* Where:
Script '/work/frontend/android/variables.gradle' line: 1
* What went wrong:
A problem occurred evaluating script.
> No signature of method: variables_2korpwrcaee01m95nsn5cvof.ext() is applicable for argument types:
(variables_2korpwrcaee01m95nsn5cvof$_run_closure1) values:
[variables_2korpwrcaee01m95nsn5cvof$_run_closure1@6c174daa]
Possible solutions: exec(groovy.lang.Closure), exec(org.gradle.api.Action), wait(), run(), run(), any()
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from
your own scripts or plugins.
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 407ms
➜ frontend git:(fix/lean/get-mobile-working) ✗
ext {
minSdkVersion = 22
compileSdkVersion = 32
targetSdkVersion = 32
androidxAppCompatVersion = '1.4.2'
androidxCoreVersion = 1.8.0
androidxMaterialVersion = '1.1.0-rc02'
androidxBrowserVersion = '1.2.0'
androidxLocalbroadcastmanagerVersion = '1.0.0'
firebaseMessagingVersion = '20.1.2'
playServicesLocationVersion = '17.0.0'
junitVersion = 4.13.2
androidxJunitVersion = 1.1.3
androidxEspressoCoreVersion = 3.4.0
cordovaAndroidVersion = 10.1.1
androidxActivityVersion = '1.4.0'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxFragmentVersion = '1.4.1'
coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0'
}