cordova-android: Build failing after upgrade cordova-android 10

Bug Report

Problem

When I upgraded cordova-android@9.0.0 to cordova-android@10.1.1 I’ve got a build problem when I run: cordova build android --release --buildconfig=build.json

What does actually happen?

Problems:

* 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.

Information

I’ve already tried:

  • Updated some dependencies outdated
  • Remove cordova-android-play-services-gradle-release cordova-android-support-gradle-release cordova-support-google-services
  • Add in config.xml
    <preference name="GradlePluginGoogleServicesEnabled" value="true" /> and
    <preference name="GradlePluginGoogleServicesVersion" value="4.3.8" />
    but when I did that, I’ve got another error:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.google.gms.google-services'.
   > Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

Command or Code

Environment, Platform, Device

This problem occurs in windows and linux.

Version information

Ionic CLI: 5.4.16 Ionic Framework: ionic-angular 3.9.8 @ionic/app-scripts: 3.2.4

Cordova CLI: 10.0.0 Cordova Platorms: android 10.1.1

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 24 (3 by maintainers)

Most upvoted comments

@cool-projects I was about to close this issue because I got a solution that solves the problem. As it is not ideal, I will still leave this issue open to see if any maintainer fixes this issue.

Solution: https://stackoverflow.com/questions/69856650/build-failing-after-upgrade-cordova-android-10

It’s happening to me too! any ideias??

@bradeaton Just make sure you have the config.xml updated with <preference name="android-targetSdkVersion" value="30" /> then you are good.

Same issue here. My Ionic 5 application is now breaking. I can’t build for API Level 30 as per Google Play Console new requirement as of 1st of November 2021. Any ideas?