我在使用Gradle在Android Studio上构建应用时遇到此重复文件错误:
Error:duplicate files during packaging of APK /Users/lgorse/AndroidStudioProjects/Androidhive-test/app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: lib/armeabi/libavcodec-55.so
Origin 1: /Users/lgorse/AndroidStudioProjects/Androidhive-test/app/build/intermediates/exploded-aar/io.cine/cineio-broadcast-android-sdk/0.0.9/jni/armeabi/libavcodec-55.so
Origin 2: /Users/lgorse/AndroidStudioProjects/Androidhive-test/app/build/intermediates/exploded-aar/Androidhive-test/kickflip-android-sdk/unspecified/jni/armeabi/libavcodec-55.so
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'lib/armeabi/libavcodec-55.so'
}
}
我已经在this answer.中实施了解决方案但问题仍然存在。
我实际上试图在所有3个build.gradles(应用程序和依赖项的两个模块)中驱逐程序包。
以下是应用build.gradle的示例:
android {
compileSdkVersion 21
buildToolsVersion '21.1'
defaultConfig {
applicationId "com.example.lgorse.androidhive_test"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
debuggable true
}
}
packagingOptions {
exclude 'lib/armeabi/libavcodec-55.so'
}
}