myrocks2
myrocks2

Reputation: 305

Android Support Library Gradle Conflict

I am having an issue regarding the inconsistent version of Android support libraries used in my app, but after specifying the exact same version in my Gradle I still get the same error.

The problem is specifically between 'com.android.support:appcompat-v7:23.1.0' and 'com.android.support:support-v4:24.0.0'. Even after specifying to compile 'com.android.support:support-v4:23.1.0' it still says there is a conflict with support-v4:24.0.0. Any help to resolve this issue will be greatly appreciated.

enter image description here

Edit: Below is my entire build.gradle file.

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

def keystorePropertiesFile = rootProject.file("keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    signingConfigs {
        config {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    compileSdkVersion 23
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "com.company"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 48
        versionName "5.1.5"
        multiDexEnabled true
    }
    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'


    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:support-annotations:23.1.0'

    compile 'com.parse.bolts:bolts-android:1.4.0'
    compile files('libs/Parse-1.13.0/Parse-1.13.0.jar')

    compile 'com.pkmmte.view:circularimageview:1.1'

    compile 'com.google.code.gson:gson:2.7'

    // SugarORM
    compile 'com.github.satyan:sugar:1.5'

    compile 'com.android.support:multidex:1.0.1'

    // Firebase
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'

    // Google play services
    compile 'com.google.android.gms:play-services-location:10.2.0'
    compile 'com.google.android.gms:play-services-places:10.2.0'

    // Timber logging
    compile 'com.jakewharton.timber:timber:4.5.0'

    compile 'joda-time:joda-time:2.9.7'

    // Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
}

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

Upvotes: 4

Views: 3225

Answers (3)

Mahdi-Malv
Mahdi-Malv

Reputation: 19220

In these situations when a library version is different from other versions, I suggest you add that library in your dependencies with the version equal to others.

In your case, you can add all libraries with version 25.3.1.

Upvotes: 0

ישו אוהב אותך
ישו אוהב אותך

Reputation: 29783

You need to check for the dependencies from the dependency tree with the following command in Linux:

./gradlew app:dependencies

or if you're using Windows try this:

gradlew.bat app:dependencies

Then, after you found the dependency with support-v4:24.0.0 you can exclude it with:

compile('com.library.name:version') {
  //exclude group: 'com.android.support'
  //exclude module: 'support-v7'
  //exclude module: 'appcompat-v7'
  exclude module: 'support-v4'
}

Upvotes: 3

Jared Burrows
Jared Burrows

Reputation: 55527

Look at your android DSL:

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
}

If buildToolsVersion is 25+, so should compileSdkVersion.

Since buildToolsVersion is 25+, then your support libraries should be as well:

dependencies {
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-annotations:25.3.1'
}

Upvotes: 0

Related Questions