所有的android支持库必须使用完全相同的版本无法正常工作 [英] all android support libraries must use exact same version not working

查看:97
本文介绍了所有的android支持库必须使用完全相同的版本无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也是这个帖子

所有com.android.支持库必须使用完全相同的版本规范

我升级降级了多个版本的android支持库.但是我经常遇到这个错误.特别是在这些行上

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 .

这是应用gradle文件

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'
}

有没有哪个特定的Android Studio可以自动设置所有现有库的版本? 我需要一些建议

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

推荐答案

有什么特殊的Android Studio可以自动设置 所有现有库的版本?

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

是的,android studio将通过此代码自动设置所有现有库的版本. 将其放在build.gradle中的应用程序模块的末尾.

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'
        }
    }
}

这将找到所有支持依赖项,并将其版本强制为27.0.2.这样可以解决您的问题.

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

这篇关于所有的android支持库必须使用完全相同的版本无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆