关于androidX的exifinterface Build错误,但我没有迁移到androidX

时间:2019-01-26 12:30:46

标签: android gradle android-gradle build.gradle androidx

当我尝试构建应用程序时,它在“构建”选项卡上给我这个错误

  

使用操作系统独立路径'META-INF / androidx.exifinterface_exifinterface.version找到了多个文件

而且我没有在任何模块中使用AndroidX

我也将此添加到我的build.gradle

packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }

dependencies

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    implementation "com.android.support:design:$supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$supportLibraryVersion"
    implementation "com.android.support:exifinterface:$supportLibraryVersion"
    implementation "com.android.support:support-media-compat:$supportLibraryVersion"
    implementation "com.android.support:support-v4:$supportLibraryVersion"

}

2 个答案:

答案 0 :(得分:0)

但是您没有将等级更改为Android X库。只需将整个项目迁移到Android X。

答案 1 :(得分:-1)

必须将此行添加到我的packagingOptions

exclude 'META-INF/androidx.exifinterface_exifinterface.version'

所以我的packagingOptions这样的改变

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/proguard/androidx-annotations.pro'
    exclude 'META-INF/androidx.exifinterface_exifinterface.version'
}