Haris
Haris

Reputation: 1862

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

I created an empty project, just put stripe in gradle,

Gradle line

implementation 'com.stripe:stripe-android:6.1.2'

and I'm getting error on this line after syncing here.

implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha3, 27.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha3 and com.android.support:design:27.1.0

Upvotes: 0

Views: 192

Answers (2)

adityakamble49
adityakamble49

Reputation: 2011

Stripe library uses 27.1.0 version of Android support libraries. See Here

You need to match that version with your all android support libraries. or you will get that error

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha3, 27.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha3 and com.android.support:design:27.1.0

You can maintain that manually or add following script to project level build.gradle

This will force all versions of Android Support library to use same version So you won't have to maintain it manually

allprojects {

    // Force all of the primary support libraries to use the same version.
    configurations.all {
        resolutionStrategy {
            eachDependency { details ->
                if (details.requested.group == 'com.android.support') {
                    details.useVersion versions.supportLibrary
                }
            }
        }
    }
}

Edit 1

Here how you can manage it with more reliable way

dependencies.gradle

buildscript {

    ext.versions = [
            // Basic
            'supportLibrary'       : '27.1.0',
    ]

    allprojects {

        // Force all of the primary support libraries to use the same version.
        configurations.all {
            resolutionStrategy {
                eachDependency { details ->
                    if (details.requested.group == 'com.android.support') {
                        details.useVersion versions.supportLibrary
                    }
                }
            }
        }
    }
}

project level build.gradle

buildscript {
    . . .
}

apply from: 'dependencies.gradle'

module level build.gradle

dependencies {

    ...

    implementation "com.android.support:appcompat-v7:${versions.supportLibrary}"
    implementation "com.android.support:design:${versions.supportLibrary}"
    implementation "com.android.support:support-vector-drawable:${versions.supportLibrary}"

    ...
}

This is how you can easily manage all Android Support library versions

Upvotes: 2

masoud vali
masoud vali

Reputation: 1536

The stripe library use the 27.1.0 version in its dependencies so you should use the same version too. Just change it to this:

implementation 'com.android.support:design:27.1.0'

implementation 'com.android.support:appcompat-v7:27.1.0'

Upvotes: 0

Related Questions