Alex
Alex

Reputation: 383

Could not solve "All com.android.support libraries must use the exact same version specification"

I can not compile my project with the latest targetSdkVersion 28 and gradle:3.3.2 because of dependency conflicts "All com.android.support libraries must use the exact same version specification"

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 369
        versionName "4.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "tier"
    productFlavors {
       playStoreFree {
            ...
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

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

I read a lot of answers on stackoverflow about this issue but non of them really helped me to solve the problem. I am not doing anything fancy here, just trying to include all latest standard libs for google play, google ads, firebase, facebook etc. Can someone tell me the correct configuration for this?

Currently I have a working configuration for targetSDKVersion 27:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 369
        versionName "4.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "tier"
    productFlavors {
       playStoreFree {
            ...
        }
    }
}
repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':SliderPreference')
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.google.android.gms:play-services-analytics:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
}

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

Upvotes: 0

Views: 164

Answers (3)

Alex
Alex

Reputation: 383

Seems that it works this way. Great :)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 369
        versionName "4.0.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "tier"
    productFlavors {
       ...
    }


repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':SliderPreference')
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

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

Upvotes: 0

Talha Arshad
Talha Arshad

Reputation: 143

You are using some libraries in your project. One of them must be using different version(probably lower version) of support library. Authors of those libraries needs to update them. But until then, you can watch below mentioned video for solution. The approach used in this video would be a great help for you.

https://www.youtube.com/watch?v=d-gvn-Z9hFs

Upvotes: 0

Gavin Wright
Gavin Wright

Reputation: 3212

For me it's always a matter of adding these:

implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'

And it looks like you need this one too:

implementation 'com.android.support:customtabs:28.0.0'

Upvotes: 1

Related Questions