Error applying plugin: "com.google.gms.google-services"

I followed the Google documentation to integrate my application into Google Analytics. But when adding

apply plugin: 'com.google.gms.google-services' 

and creating my application, I ran into this error:

 Error:(49, 0) For input string: "+" 

These are the settings I used in build.gradle of my application:

 apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.myapp.xyz" manifestPlaceholders = [ manifestApplicationId : "${applicationId}", onesignal_app_id : "ccd48c54-2069-41f9-8ff7-54c7a12f2d18a", onesignal_google_project_number: "306632981237" ] minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavenCentral() } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') // compile 'com.android.support:appcompat-v7:22.2.1' compile project(':facebook') compile 'com.android.support:design:22.2.1' compile 'com.android.support:palette-v7:22.2.1' compile 'com.astuetz:pagerslidingtabstrip:1.0.1' compile 'com.android.support:appcompat-v7:22.2.1' compile 'com.android.support:support-v4:22.2.1' compile 'com.onesignal:OneSignal: 1.+@aar ' compile 'com.google.android.gms:play-services-gcm:+' compile 'com.google.android.gms:play-services:8.4.0' compile 'com.google.android.gms:play-services-analytics:8.4.0' } apply plugin: 'com.google.gms.google-services' 

This is the parameter in the build.gradle application:

 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' classpath 'com.google.gms:google-services:2.0.0-alpha6' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } 
+7
android
source share
8 answers

You must call first

  dependencies { classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.google.gms:google-services:2.0.0-alpha2' } 

Do not (do not call + )

 compile 'com.google.android.gms:play-services-gcm:+' compile 'com.google.android.gms:play-services:8.4.0' 

Do

  compile 'com.google.android.gms:play-services:8.4.0' 
+10
source share

You need to enter the following entry as in gradle:

  • Add the following element to the @project gradle file:

     classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.google.gms:google-services:3.0.0' 
  • Add the following to the @app gradle file:

     // Dependency for Google Sign-In compile 'com.google.android.gms:play-services-auth:9.4.0' 
  • Add plugin:

     apply plugin: 'com.google.gms.google-services' 
+10
source share

Replace the line compile 'com.google.android.gms:play-services-gcm:+'

with the following compile 'com.google.android.gms:play-services-gcm:8.4.0'

in the build.gradle file of the application.

+2
source share

Add the following element to the @project gradle file:

  classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.google.gms:google-services:3.0.0' 
+2
source share

Like many ppls, I added " classpath" com.google.gms: google-services: 3.0.0 "at the project level gradle.

But I ran into another error: "The google-services.json file is not in the root folder of the module." . In the end, I needed to create a project using the following link. https://developers.google.com/mobile/add?platform=android

After setting up the project, I needed to go to the Firebase console. On this page, I was able to download the google-service.json file, which was necessary to solve this problem.

Drag this JSON file to your project / application folder.

It took me an hour to figure this out. I hope this will be helpful to someone.

+1
source share

I had this exact problem and the following was fixed: go to platforms> android> project.properties and edit the lines

 cordova.system.library.5=com.google.android.gms:play-services-auth:+ cordova.system.library.6=com.google.android.gms:play-services-identity:+ 

to

 cordova.system.library.5=com.google.android.gms:play-services-auth:11.0.1 cordova.system.library.6=com.google.android.gms:play-services-identity:11.0.1 

They say # Do not modify this file -- YOUR CHANGES WILL BE ERASED! But that fixed my problem

0
source share

Change the following code in project.properties to:

 cordova.system.library.2=com.google.android.gms:play-services-gcm:+ cordova.system.library.3=com.google.android.gms:play-services-location:+ 

to

 cordova.system.library.2=com.google.android.gms:play-services-gcm:11.0.1 cordova.system.library.3=com.google.android.gms:play-services-location:11.0.1 

and add google-service.json file to application module

0
source share

Error: execution completed for task ': app: processDebugGoogleServices'.

Correct the version conflict either by updating the version of the google-services plugin (information on the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/ ) or update the version of com.google .android.gms up to 10.0.1.

-2
source share

All Articles