首页 > 解决方案 > Android-Cordova 10.0.1 任务:app:processDebugGoogleServices 失败

问题描述

我已将 cordova-android 版本从 9.0 升级到 10.0.1,并在使用 - ionic cordova build android 构建 Cordova 应用程序时面临以下问题

错误:

Task :app:processDebugGoogleServices FAILED
Some problems were found with the configuration of task ':app:processDebugGoogleServices' (type 'GoogleServicesTask').
  - In plugin 'com.google.gms.google-services' 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.google-services' type 'com.google.gms.googleservices.GoogleServicesTask' field 'packageNameXOR1' without corresponding getter has been annotated with @Input.

信息

科尔多瓦 CLI - 10.0.0

科尔多瓦机器人:10.0.1

节点:v12.18.2

npm:6.14.13

项目安装插件

@havesource/cordova-plugin-push: 2.0.0
    cordova-android-play-services-gradle-release: 4.0.0
    cordova-background-geolocation-lt: 4.0.1
    cordova-plugin-advanced-http: 3.1.0
    cordova-plugin-android-permissions: 1.1.2
    cordova-plugin-androidx-adapter: 1.1.3
    cordova-plugin-androidx: 3.0.0
    cordova-plugin-app-launcher: 0.4.0
    cordova-plugin-app-version: 0.1.12
    cordova-plugin-appminimize: 1.0.1
    cordova-plugin-background-fetch: 7.0.1
    cordova-plugin-badge: 0.8.8
    cordova-plugin-camera: 5.0.2
    cordova-plugin-device: 2.0.3
    cordova-plugin-file-opener2: 3.0.5
    cordova-plugin-file: 6.0.2
    cordova-plugin-filepath: 1.6.0
    cordova-plugin-googlemaps: 2.7.1
    cordova-plugin-inappbrowser: 5.0.0
    cordova-plugin-ionic-keyboard: 2.2.0
    cordova-plugin-ionic-webview: 4.2.1
    cordova-plugin-local-notification: 0.9.0-beta.2
    cordova-plugin-market: 1.2.0
    cordova-plugin-ms-azure-mobile-apps: 2.0.2
    cordova-plugin-network-information: 2.0.2
    cordova-plugin-sim: 1.3.3
    cordova-plugin-sms-retriever-manager: 1.0.2
    cordova-plugin-splashscreen: 6.0.0
    cordova-plugin-statusbar: 2.4.3
    cordova-plugin-twilio-chat: 3.3.0
    cordova-plugin-whitelist: 1.3.4
    cordova-sqlite-storage: 6.0.0
    phonegap-plugin-barcodescanner: 8.1.0
    phonegap-plugin-multidex: 1.0.0

谁能知道如何解决这个问题?

标签: androidcordovaionic-frameworkgoogle-play-servicescordova-plugins

解决方案


我通过在 config.xml 文件中添加以下首选项解决了这个问题:

<preference name="android-targetSdkVersion" value="30" />
<preference name="AndroidXEnabled" value="true" />
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
 
 <!-- Updated the version of com.google.gms.google-services -->
<preference name="GradlePluginGoogleServicesVersion" value="4.3.8" /> ,

包.json:

"cordova-android": "^10.1.0"

摇篮版本:7.1.1


推荐阅读