React Native Android Push Notifications Fail

Hi - following instructions in this https://backendless.com/setup-push-notifications-in-react-native-android/ link, the process fails at this step:

apply plugin: ‘com.google.gms.google-services’

When I try to load the app I get the following stack trace error:

Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object: org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:processDebugGoogleServices FAILED
14 actionable tasks: 2 executed, 12 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
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.3.3/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 'packageName' 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 'packageName'.
      2. Remove the annotations on 'packageName'.
    
    Please refer to https://docs.gradle.org/7.3.3/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 '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.3.3/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 '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.3.3/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

BUILD FAILED in 9s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
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.3.3/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 'packageName' 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 'packageName'.
      2. Remove the annotations on 'packageName'.
    
    Please refer to https://docs.gradle.org/7.3.3/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 '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.3.3/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 '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.3.3/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

BUILD FAILED in 9s

    at makeError (/Users/kamrezvani/Desktop/Backendless/RNPushDemo/node_modules/execa/index.js:174:9)
    at /Users/kamrezvani/Desktop/Backendless/RNPushDemo/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async runOnAllDevices (/Users/kamrezvani/Desktop/Backendless/RNPushDemo/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/Users/kamrezvani/Desktop/Backendless/RNPushDemo/node_modules/@react-native-community/cli/build/index.js:192:9)```


I am adding this config line to the bottom of the build.gradle file in the app directory as instructed. When I comment this line out, then the app runs without an error.

Hi Kam,

I see a lot of errors unrelated to Backendless. You should clear them first and then if there is a problem specific to our code, we can look into it.

Regards,
Mark

Hi Mark,

I am adding this config line:

apply plugin: ‘com.google.gms.google-services’

to the bottom of the build.gradle file in the app directory as instructed. When I comment this line out, then the app runs without an error. I understand this error may be unrelated to Backendless but I am just following instructions on the webpage. I think the instructions may need to be updated if I am not mistaken.

Thanks,
Kam

I think it would be unreasonable to expect that we provide support for google services for the gazzilion number of things that may go wrong with them. The errors you’re getting already include possible solutions. You need to work through those to get them all cleared.

Changed:

classpath(“com.google.gms:google-services:4.0.1”)

to

classpath(“com.google.gms:google-services:4.1.0”)

in build.gradle and it worked.