Android-Cordova 10.0.1 Task :app:processDebugGoogleServices FAILED
Asked Answered
T

3

5

I have upgraded the cordova-android version from 9.0 to 10.0.1 and facing the below issues while building the Cordova app using - ionic cordova build android

Errors:

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.

Info:

Cordova CLI - 10.0.0

Cordova android: 10.0.1

Node: v12.18.2

npm: 6.14.13

Project Installed Plugins:

@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

Can anyone have an idea how to resolve this issue?

Thebault answered 12/8, 2021 at 11:41 Comment(0)
T
8

I have resolved this by using adding the below preferences in config.xml file:

<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" /> ,

Package.json:

"cordova-android": "^10.1.0"

Gradle version: 7.1.1

Thebault answered 27/8, 2021 at 14:52 Comment(0)
Y
1

It finally worked for me. I changed the gradle version used to 6.7.1 and reinstall some outdated cordova plugins.

plugins used:

@havesource/cordova-plugin-push 2.0.0 "Cordova Push Plugin"
cordova-plugin-advanced-http 2.5.1 "Advanced HTTP plugin"
cordova-plugin-camera 5.0.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-googleplus 8.5.0 "Google SignIn"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-wkwebview-inject-cookie 1.0.2 "WKWebViewInjectCookie"
cordova-support-google-services 1.1.0 "cordova-support-google-services"
Yoko answered 14/8, 2021 at 5:19 Comment(3)
Can you send me the plugin versions you are using? So, I can upgrade those and check itThebault
Answers are updated with plugins currently used. Have you tried using gradle 6.7.1?Yoko
Whitelist plugin is deprecated for cordova android 10. and it is not supported. How were you able to build using version 10? npmjs.com/package/cordova-plugin-whitelistThebault
T
0

In my case none of the provided answers were helpful. Take a look here fix-google-services for other solution in config, maybe for somebody it will help.

I have 9.1.0 version of 'cordova-android' which is not supporting Android API 30+ Android API Levels and Android Versions

How I fixed the issue OR how I hack the solution: Run:

  1. cordova platform rm android
  2. cordova platform add android

This should generate a "build.gradle" file in platforms\android Then, manually change "project.ext" part of code and specify version which you want, in my case I need to support 30 API version:

project.ext {
  defaultBuildToolsVersion="30.0.0" //String
  defaultMinSdkVersion=23 //Integer - Minimum requirement is Android 5.1
  defaultTargetSdkVersion=30 //Integer - We ALWAYS target the latest by default
  defaultCompileSdkVersion=30 //Integer - We ALWAYS compile with the latest by default
}

You can modify sh script proposed by @Mike (in 1 link) for this needs.

Btw, when i was trying to fix the issue on cordova-android version 10 - this block of code was even not presented in "build.gradle".

What protentionally could help too:

  1. Remove cordova-plugin-whitelist - it is not supported from version 10.
  2. In SDK Platforms manager - download needed API Level; enter image description here
  3. In SDK Tools manager - download needed build tools version; enter image description here
Typist answered 25/11, 2021 at 13:33 Comment(2)
We should not change the file manually in "platforms\android" which are auto generated.Thebault
@Thebault yes, I agree also mentioned that it is a hack, because no other solutions didn`t work for me.Typist

© 2022 - 2024 — McMap. All rights reserved.