android支持库必须使用完全相同的版本吗?

时间:2018-09-01 14:14:09

标签: android gradle gradle-dependencies

我正在尝试导入以下库:

    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'

但同步时出现以下错误:

  

所有com.android.support库必须使用完全相同的版本   规范(混合版本可能导致运行时崩溃)。找到了   版本28.0.0-rc01、27.1.0。例子包括   com.android.support:animated-vector-drawable:28.0.0-rc01和   com.android.support:exifinterface:27.1.0 ...

我尝试添加以下内容,但没有任何帮助。我该如何解决?

implementation 'com.android.support:exifinterface-28.0.0-rc01'

1 个答案:

答案 0 :(得分:0)

请确保您在 build.gradle 文件中的Android块中包含compileSdkVersion 28targetSdkVersion 28

还要确保您的依赖项块中有appcompat-v7:28.0.0-rc01

然后我认为可以毫无问题地添加implementation 'com.android.support:exifinterface:28.0.0-rc01'

我正在粘贴 build.gradle(Module:app)供参考。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.chirag.example.retrofeitdemo"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:exifinterface:28.0.0-rc01'
}
相关问题