更新到Android Studio 2.3和Gradle 3.3后,我在生成签名APK时开始收到错误:
Error:java.io.IOException: Duplicate zip entry [classes.jar:com/google/android/gms/internal/zzbqv.class]
升级后我添加了这些依赖项:
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:mediarouter-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:palette-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
我的build.gradle是:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxx')
storePassword 'xxx'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxx"
minSdkVersion 21
targetSdkVersion 25
versionCode 22
versionName "0.3.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
debuggable false
minifyEnabled true
}
}
}
allprojects {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.mikepenz:materialdrawer:5.8.2@aar') {
transitive = true
}
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:customtabs:25.2.0'
compile 'com.android.support:mediarouter-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:palette-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.firebaseui:firebase-ui:1.1.1'
compile 'com.afollestad.material-dialogs:core:0.9.3.0'
compile 'com.github.clans:fab:1.6.4'
compile 'com.github.GrenderG:Toasty:1.1.3'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
规则是:
-dontwarn org.w3c.dom.**
-dontwarn org.joda.time.**
-dontwarn org.shaded.apache.**
-dontwarn org.ietf.jgss.**
-dontwarn com.firebase.**
-dontnote com.firebase.client.core.GaePlatform
-keepattributes Signature
-keepattributes *Annotation*
# -keepattributes InnerClasses,EnclosingMethod
-keep class xxxx.FirebaseModels.** { *; }
# Basic ProGuard rules for Firebase Android SDK 2.0.0+
-keep class com.firebase.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }
以前的版本仍会生成没有错误的APK。
请帮我找到解决这个问题的方法。