當前行為
嘗試為 Android 構建 Ionic Cordova 應用程式時,出現以下錯誤:
構建命令: ionic cordova build android --prod --release
Task :app:processReleaseGoogleServices FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':app:processReleaseGoogleServices' (type 'GoogleServicesTask').
- In plugin 'com.google.gms.googleservices.GoogleServicesPlugin' type 'com.google.gms.googleservices.GoogleServicesTask' field 'intermediateDir' without corresponding getter has been annotated with @OutputDirectory.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'intermediateDir'.
2. Remove the annotations on 'intermediateDir'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.googleservices.GoogleServicesPlugin' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR1' without corresponding getter has been annotated with @Input.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'packageNameXOR1'.
2. Remove the annotations on 'packageNameXOR1'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.googleservices.GoogleServicesPlugin' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR2' without corresponding getter has been annotated with @Input.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'packageNameXOR2'.
2. Remove the annotations on 'packageNameXOR2'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.googleservices.GoogleServicesPlugin' type 'com.google.gms.googleservices.GoogleServicesTask' field 'quickstartFile' without corresponding getter has been annotated with @InputFile, @Optional.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'quickstartFile'.
2. Remove the annotations on 'quickstartFile'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
- In plugin 'com.google.gms.googleservices.GoogleServicesPlugin' type 'com.google.gms.googleservices.GoogleServicesTask' field 'searchedLocation' without corresponding getter has been annotated with @Input.
Reason: Annotations on fields are only used if there's a corresponding getter for the field.
Possible solutions:
1. Add a getter for field 'searchedLocation'.
2. Remove the annotations on 'searchedLocation'.
Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
* 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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 6s
4 actionable tasks: 2 executed, 2 up-to-date
Command failed with exit code 1: /Users/derekmiller/Zogo/Zogo-Frontend/platforms/android/gradlew :app:bundleRelease -b /Users/derekmiller/Zogo/Zogo-Frontend/platforms/android/build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova build android --release exited with exit code 1.
從cordova-android升級8.1.1到10.1.1. 我們被迫進行此更改,以便我們可以針對 Android API 30。
預期行為
成功構建的應用程式
我試過什么
- 大多數遇到此錯誤的其他人表示,可以通過確保 google services 版本來解決這個問題
4.3.8 - 我們試圖通過
classpath com.google.gms:google-services:4.3.8直接在build.gradle - 我們還嘗試通過添加以下內容來做到這一點
config.xml:
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
<preference name="GradlePluginGoogleServicesVersion" value="4.3.8" />
這兩個更改后錯誤仍然存??在
<preference name="AndroidXEnabled" value="true" />在我的設定config.xml
技術細節
離子 CLI:5.4.16
科爾多瓦 CLI:9.0.0
科爾多瓦安卓:10.1.1
Android SDK 工具:26.1.1
作業系統:macOS Big Sur
專案.屬性:
target=android-30
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.gradle.include.1=branch-cordova-sdk/child-rules.gradle
cordova.system.library.1=com.google.android.play:core:1.8.0
cordova.gradle.include.2=cordova-plugin-fcm-with-dependecy-updated/child-FCMPlugin.gradle
cordova.system.library.2=com.google.firebase:firebase-core:16.0.9
cordova.system.library.3=com.google.firebase:firebase-messaging:18.0.0
cordova.gradle.include.3=cordova-plugin-ionic/child-cordovapluginionic.gradle
cordova.system.library.4=com.google.android.gms:play-services-analytics:11.0.1
cordova.system.library.5=androidx.annotation:annotation:1.1.0
cordova.system.library.6=com.mixpanel.android:mixpanel-android:5.9.1
cordova.system.library.7=com.google.android.gms:play-services-base:16.
cordova.system.library.8=com.google.firebase:firebase-messaging:16.
cordova.system.library.9=androidx.legacy:legacy-support-v4:1.0.0
uj5u.com熱心網友回復:
我只是想問你是否嘗試過在不更改構建檔案本身的情況下按以下方式進行操作,如果沒有,請嘗試并重建它,讓我知道
升級:
cordova platform remove android
cordova platform add android@10.1.1
uj5u.com熱心網友回復:
我通過在根目錄中設定全域谷歌服務版本解決了這個問題 build.gradle
allprojects {
// other settings
ext {
GOOGLE_SERVICES_VERSION = '4.3.10'
}
}
我試圖設定谷歌服務版本的其他方法不起作用,因為有一些其他插件試圖使用不同版本的谷歌服務。我相信以這種方式設定版本可以確保它們都使用相同的版本。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/358654.html
上一篇:Cordova應用程式、minSdkVersion30和錯誤“minCompileSdk(31)specifiedina”
