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.
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 :)
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.
I also faced the same issue. But I forgot to add google-services.json in my project. You can get this file from Google.
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"
}
I've solved this problem by deleting the google-services.json file and downloading it again from Firebase console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With