More than one file was found with OS independent path ‘META-INF/DEPENDENCIES‘.(android studio报错)

More than one file was found with OS independent path ‘META-INF/DEPENDENCIES’.
出现这个问题是因为引入了多个第三方库,而第三方库中拥有很多重名的文件,所以会报这种错误

 packagingOptions {
        exclude 'META-INF/****
    }

exclude ‘META-INF/****:后面是什么错误就写什么,例如我的错误是’META-INF/DEPENDENCIES’,所以要写成下面这样:

 packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }

那么具体位置在哪里呢:
错误
选取自己出错的build.grade,然后修改:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }






//注意,只添加这条语句即可
//*************************************
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
//*************************************




    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}


repositories {
    google()
    mavenCentral()
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation files('libs\\okhttp-3.2.0.jar')
    implementation files('libs\\httpmime-4.0.1.jar')
    implementation files('libs\\httpcore-nio-4.0.1.jar')
    implementation files('libs\\httpcore-4.0.1.jar')
    implementation files('libs\\httpclient-4.0.1.jar')
    implementation files('libs\\commons-logging-1.1.jar')
    implementation files('libs\\commons-lang-2.5.jar')
    implementation files('libs\\okio-1.12.0.jar')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值