已解決此問題。 我刪除了所有* .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如何編輯我的代碼..? –