shA*_*kur 2 android azure ionic-framework azure-devops azure-pipelines
我们使用 Microsoft Azure Pipelines 为 ios 和 android 构建 Ionic 应用程序。不幸的是,我们在构建 android 应用程序时遇到以下错误。
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
Run Code Online (Sandbox Code Playgroud)
奇怪的是,几天前它没有任何问题地工作。用于生成 APK 的命令
sudo npx jetify
sudo ionic capacitor sync android
cd android && gradle wrapper && sudo ./gradlew assembleRelease `//this is where it fails`
Run Code Online (Sandbox Code Playgroud)
奇怪的是确实如此。我有同样的问题,没有任何好的解释,但我也有一个可行的解决方案。更换线路
targetSdkVersion targetSdkVersion = project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
和
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
工作,对我来说比作业更有意义。
编辑:显然这是正确的修复,电容器存储库中最近的拉取请求也是如此:https : //github.com/ionic-team/capacitor/pull/4788或修复https://github.com/ionic -team/capacitor/pull/4788/commits/250fdcf03be6510dd629a91a98b5220e14d31664