We use Microsoft Azure Pipelines for building Ionic apps for both ios and android. Unfortunately we encounter the following error while building the android app.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/vsts/work/1/s/android/capacitor-cordova-android-plugins/build.gradle' line: 21
* What went wrong:
Could not compile build file '/home/vsts/work/1/s/android/capacitor-cordova-android-plugins/build.gradle'.
> startup failed:
build file '/home/vsts/work/1/s/android/capacitor-cordova-android-plugins/build.gradle': 21: unable to resolve class targetSdkVersion
@ line 21, column 26.
targetSdkVersion targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
The strange part is that several days ago it worked without any problems. Commands used to generate the APK
sudo npx jetify
sudo ionic capacitor sync android
cd android && gradle wrapper && sudo ./gradlew assembleRelease `//this is where it fails`