Neeraj Verma
Neeraj Verma

Reputation: 2314

all android support libraries must use exact same version not working

Edit : i also this post

All com.android.support libraries must use the exact same version specification

i upgrade downgrade multiple version of android support libraries . but i am constantly getting this error . specially on these lines

compile 'com.android.support:cardview-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'

i clean and rebuild multiple times , but that is not solution

there is no specifically any solution which i got except changing library version .

this is app gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.2'

    defaultConfig {
        applicationId "com.codepath.the_town_kitchen"
        minSdkVersion 27
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    signingConfigs {
        debug {
            storeFile file("keystore/debug.keystore")
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories { mavenCentral() }

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')


    //compile 'com.android.support:appcompat-v7:21.0.3'
    //compile 'com.android.support:support-v4:21.0.3'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.loopj.android:android-async-http:1.4.6'
    compile 'com.google.android.gms:play-services:6.5.87'
    // ActiveAndroid for simple persistence with an ORM
    compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
    compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.github.johnkil.android-robototextview:robototextview:2.3.0'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    //compile 'com.stripe:stripe-android:+'
    // compile 'com.android.support:cardview-v7:21.0.2'
    compile 'com.android.support:recyclerview-v7:27.0.2'
    compile 'com.android.support:cardview-v7:27.0.2'

    //compile 'com.android.support:design:26.0.2'

    compile 'com.makeramen:roundedimageview:1.5.0'
    //compile 'com.stripe:stripe-android:2.0.2'
}

is there any particular by whoch android studio can automatically set version of all existing libraries ? i need some suggestions

Upvotes: 0

Views: 1421

Answers (2)

Jaydip Kalkani
Jaydip Kalkani

Reputation: 2607

is there any particular by whoch android studio can automatically set version of all existing libraries ?

Yes, android studio will automatically set version of all existing libraries by this code. Put this at the end of your app module in build.gradle.

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            details.useVersion '27.0.2'
        }
    }
}

This will find all support dependencies and force their versions to be 27.0.2. This will solve your problem.

Upvotes: 4

user6490462
user6490462

Reputation:

To avoid this you need to update your libs too.

Your libs like Picasso also contain 'com.android.support' library which need to be compatible with you app 'com.android.support' library, And I can see you used old versions of library which contain old version of 'com.android.support'.

You need to use libs that contain the compatible 'com.android.support' version, In your case it's 27.0.2

For example Picasso needed to upgrade to 2.5.2 instead.

Upvotes: 1

Related Questions