我在运行我的应用程序时发现了此错误,并且我尝试了一些解决此问题的方法。但是它并没有解决我的问题。
我已经将这些行添加到我的build.gradle文件中
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENCE'
}
但是仍然存在相同的错误。 错误日志
Error:duplicate files during packaging of APK I:\CameraPhotoVideoUpload\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/LICENSE
Origin 1: I:\CameraPhotoVideoUpload\app\libs\httpmime-4.3.6.jar
Origin 2: I:\CameraPhotoVideoUpload\app\libs\httpclient-4.3.6.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE
File 1: I:\CameraPhotoVideoUpload\app\libs\httpmime-4.3.6.jar
File 2: I:\CameraPhotoVideoUpload\app\libs\httpclient-4.3.6.jar
Information:BUILD FAILED
我无法理解问题。任何人都可以帮忙吗?
摇篮文件
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENCE'
}
compileSdkVersion 21
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "info.androidhive.camerafileupload"
minSdkVersion 11
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
}
}