On an empty project, after adding firebase it leads to the following error:
Image Version :-
The error occurs because google-services is implementing some libraries, which are not using the 27.1.1 version. So we need to override the version.
In order to do so, always try to do run this in the terminal of android studio:
./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath
This will show you a list of dependencies, which shows the version number along it, something like this :-
Here we need to find those dependencies whose haven't been overwritten and have a version number like 25 or 26 and not overwritten to 27.
Like in the above example we have com.android.support:support-v4:25.2.0
Now we just need to add this to the dependencies block with the up to date version number.
Finally, the dependency block looks like this:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-auth:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Here we are adding
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
To fix the second error of
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
In project build.gradle, update the
classpath 'com.google.gms:google-services:3.1.1'
to
classpath 'com.google.gms:google-services:3.2.0'