LordCommanDev
LordCommanDev

Reputation: 922

Firebase version conflicts with support library

I know this is a common question and I already read several posts and modify many times my gradle file but I can't find the solution.

The error message is: All com.android.support libraries must use the exact same version specification. Found versions 28.0.0, 26.1.0.

But I don't know where the 26.1.0 version is. Any idea how to fix it?

This is my build.gradle(module:app)

  apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'

  android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.emojify_kotlin"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
  }

  dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.8'
 }

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

And this my project gradle file

buildscript {
ext.kotlin_version = '1.3.21'
repositories {
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.2'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}}

allprojects {
repositories {
    google()
    jcenter()

}}

task clean(type: Delete) {
delete rootProject.buildDir}

Upvotes: 0

Views: 692

Answers (3)

rahul khurana
rahul khurana

Reputation: 188

override your firebase dependency with

  com.android.support:support-v4:26.1.0

Happy Coding :)

Upvotes: 0

Basi
Basi

Reputation: 3158

Using gradle app:dependencies, get a list of dependencies:

 +--- org.jetbrains.kotlin:kotlin-stdlib-jre7:..
|    \--- org.jetbrains.kotlin:kotlin-stdlib:..
|         \--- org.jetbrains:annotations:...
+--- com.google.firebase:firebase-core:16....
|    +--- com.google.firebase:firebase-analytics:16...
|    |    +--- com.google.android.gms:play-services-basement:15....
|    |    |    \--- com.android.support:support-v4:26.1.0
|    |    |         +--- com.android.support:support-compat:26.1.0 ->.......

it shows firebase needed com.android.support:support-v4:26.1.0, so you have to overwritten it with com.android.support:support-v4:28.0.0

Upvotes: 1

Gajendra_kumar
Gajendra_kumar

Reputation: 19

change

dependencies{
implementation 'com.google.firebase:firebase-core:16.0.8'
}

dependency in your app gradle from

dependencies{
   implementation 'com.google.firebase:firebase-core:15.0.0'
}

and then sync your project with these changes.

Upvotes: 0

Related Questions