Gradle Error:Execution failed for task ':app:processDebugGoogleServices'
Solution 1:
I'v got a same issue. but Now I'm fixed.
You should delete a line apply plugin: 'com.google.gms.google-services'
because "com.android.application" package already has same package.
Solution 2:
I had the same issue and resolved it by adding the following line in the dependencies of the project-level build.gradle:
classpath 'com.google.gms:google-services:3.0.0'
For a full working example, check out the following project on github.
Hope this helps :)
Solution 3:
I was finding the same error complaining about mixing google play services version when switching from 8.3 to 8.4. Bizarrely I saw reference to the app-measurement lib which I wasn't using.
I thought maybe one of my app's dependencies was referencing the older version so I ran ./gradlew app:dependencies
to find the offending library (non were).
But at the top of task output I found a error message saying that the google plugin could not be found and defaulting to google play services 8.3. I used the sample project @TheYann linked to compare. My setup was identical except I applied the apply plugin: 'com.google.gms.google-services'
at the top my app's build.gradle file. I moved to bottom of the file and that fixed the gradle compile error.
Solution 4:
I also faced the same issue. But I forgot to add google-services.json in my project. You can get this file from Google.
Solution 5:
Ensure that you have done these two things under defaultConfig
in Android/app/build.gradle
after wiring up Firebase for your Flutter app.
1) Whatever package name you entered while creating your Firebase android project, exactly the same should be updated as your applicationId
under defaultConfig
.
2) Add the line multiDexEnabled true
under defaultConfig
.
So defaultConfig{}
should now look something like this
defaultConfig {
applicationId "com.companyName.appName"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}