So, I am getting the following error while running the project after upgrading build.gradle (Project) from
dependencies {
classpath \'com.android.too
Before:
compile 'com.google.android.gms:play-services-location:10.0.1' compile 'com.google.android.gms:play-services-auth:10.0.1' compile 'com.google.firebase:firebase-database:10.2.0' compile 'com.google.firebase:firebase-core:10.2.0' compile 'com.google.firebase:firebase-messaging:10.2.0'
After:
compile 'com.google.android.gms:play-services-location:10.2.0' compile 'com.google.android.gms:play-services-auth:10.2.0' compile 'com.google.firebase:firebase-database:10.2.0' compile 'com.google.firebase:firebase-core:10.2.0' compile 'com.google.firebase:firebase-messaging:10.2.0'
Finally got resolved.
First, build -> clean project -> rebuild it again.
If its not working, then in your build.gradle
, set the multiDexEnabled
as true
eg:
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 21
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
}
For me was very easy. Just add:
//noinspection GradleDependency,GradleCompatible implementation 'com.google.android.gms:play-services-auth:11.0.4'
... and the magic happens.
For some reasons, @ChintanSoni's answer didn't worked. I tried deleting the build
folder manually but couldn't delete some files since they were being used by some process. Cleaning and re-building the project didn't help so I opened task manager
, selected JAVA(TM) Platform SE binary
and pressed on 'End task`.
Then I tried to run the project once again and it started compiling fine.
In my case, I put
apply plugin: 'com.google.gms.google-services'
at the bottom of build.gradle
file and set multiDexEnabled true
in defaultConfig. Then just run and it works.
Please add this block inside android in build.gradle
dexOptions {
preDexLibraries = false
}