导入 Httpclient、httpcore 和 httpmime 时出错
Error while importing Httpclient, httpcore & httpmime
我在 Android Studio 中遇到了这个问题。
将此添加到您应用的 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'
}
正如错误消息所暗示的那样,您没有排除存在于多个依赖项中的 META-INF/NOTICE
文件
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE
packagingOptions {
exclude 'META-INF/LICENSE' // will not include NOTICE file
exclude 'META-INF/NOTICE' // will not include NOTICE file
}
我在 Android Studio 中遇到了这个问题。
将此添加到您应用的 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'
}
正如错误消息所暗示的那样,您没有排除存在于多个依赖项中的 META-INF/NOTICE
文件
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE
packagingOptions {
exclude 'META-INF/LICENSE' // will not include NOTICE file
exclude 'META-INF/NOTICE' // will not include NOTICE file
}