已解决此问题。 我删除了所有* .jar文件并添加下面的代码。Android Studio .apk build ZipException错误
这是我的编辑的gradle代码
compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5'
compile (group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.6') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
所有。
我有一个错误,但我不知道如何解决它。 我需要你的帮助。
我不太习惯StackOverflow网站。
因为我希望你能理解我在帖子中的错误。
这是错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/MessageConstraintException.class
和我的build.gradle代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.daehwankim"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/httpclient-4.3.1.jar')
compile files('libs/httpclient-android-4.3.5.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/httpmime-4.3.1.jar')
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.github.chrisbanes:PhotoView:1.3.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
您有多个'com.google.android.gms:' –
@IntelliJAmiya如何编辑我的代码..? –