【发布时间】:2015-08-02 14:27:33
【问题描述】:
在运行应用程序时,Android Studio 中出现意外错误,以下是出现的错误消息
错误:打包 APK 时文件重复 /home/jithu/libs/android/android/aa/app/build/outputs/apk/app-debug-unaligned.apk 存档路径:META-INF/DEPENDENCIES 来源 1: /home/jithu/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.3.6/cf8bacbf0d476c7f2221f861269365b66447f7ec/httpmime-4.3.6.jar 起源2: /home/jithu/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.4.1/f5aa318bda4c6c8d688c9d00b90681dcd82ce636/httpcore-4.4.1.jar
我也在粘贴我的 build.gradle 文件
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.15'
compile 'com.google.code.gson:gson:2.2.4'
compile "org.apache.httpcomponents:httpcore:4.4.1"
compile "org.apache.httpcomponents:httpmime:4.3.6"
}
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
// ...
}
【问题讨论】:
-
删除
compile "org.apache.httpcomponents:httpmime:4.3.6"并尝试.. -
我做到了,但那个时候它允许我编译但给出以下错误 java.lang.NoClassDefFoundError: org.apache.http.entity.ContentType 05-20 18:44:58.485: E/ AndroidRuntime(395):在 org.apache.http.entity.mime.content.FileBody.
(FileBody.java:89) -
@HareshChhelana 你可以看到我已经添加了排除语句。仍然给我错误,并且正在使用最新版本的工作室。
-
@MD 如果我删除 httpmime 我们将得到以下类错过错误 import org.apache.http.entity.mime.HttpMultipartMode;导入 org.apache.http.entity.mime.MultipartEntityBuilder;导入 org.apache.http.entity.mime.content.FileBody;这些都不见了
标签: java android android-studio