3
當我嘗試構建我的android項目時出現此錯誤。首先我得到一個錯誤,我無法運行的東西,因爲AndroidMultiPartEntity.java中的問題,所以我添加了Android gradle在打包過程中生成重複文件httpmime
compile "org.apache.httpcomponents:httpmime:4.2.3"
在依賴項中。很多錯誤消失了,但是發生了這個錯誤。
Information:Gradle tasks [:app:assembleDebug]
Error:duplicate files during packaging of APK C:\Users\AkerbergE\AndroidStudioProjects\incident\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/NOTICE.txt
Origin 1: C:\Users\AkerbergE\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.2.3\118ae1bc7f3aeeddfe564f0edfd79c11d09d17d1\httpmime-4.2.3.jar
Origin 2: C:\Users\AkerbergE\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.2.2\b76bee23cd3f3ee9b98bc7c2c14670e821ddbbfd\httpcore-4.2.2.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/NOTICE.txt'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/NOTICE.txt
File 1: C:\Users\AkerbergE\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.2.3\118ae1bc7f3aeeddfe564f0edfd79c11d09d17d1\httpmime-4.2.3.jar
File 2: C:\Users\AkerbergE\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.2.2\b76bee23cd3f3ee9b98bc7c2c14670e821ddbbfd\httpcore-4.2.2.jar
Information:BUILD FAILED
Information:Total time: 3.903 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE.TXT'
}
defaultConfig {
applicationId "com.example.akerberge.incident"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile "org.apache.httpcomponents:httpmime:4.2.3"
}
我已經從排除 'META-INF/notice.txt' ,並排除 'META-INF/NOTICE.TXT' –
的它給了我同樣的錯誤: ) –
清理和重建項目,看看你還有什麼? –