Skip to content

How to use Google Services Gradle plugin

Alexander Boldyrev edited this page Nov 8, 2022 · 1 revision

In order to use Google Services Gradle Plugin and google-services.json file:

  1. Check if you have ANDROID_FIREBASE_SENDER_ID variable added to config.xml for Mobile Messaging plugin:
    <plugin name="com-infobip-plugins-mobilemessaging" spec="...">
       <variable name="ANDROID_FIREBASE_SENDER_ID" value="Firebase Sender ID" />
    </plugin>

If ANDROID_FIREBASE_SENDER_ID was added previously, verify that there is no google_app_id in /platforms/android/app/src/main/res/values/strings.xml. If google_app_id is present, delete it.

  1. Сopy-paste google-services.json file to platforms/android/app, make sure that package name in the file matches the application package name.
  2. Add preference GradlePluginGoogleServicesEnabled with value true to the config.xml file, as described in Cordova 9.0.0 announcement
    <config-file target="config.xml" parent="/*">
     <preference name="GradlePluginGoogleServicesEnabled" value="true" />
    </config-file>
  3. Run cordova prepare android
Clone this wiki locally