![](/img/trans.png)
[英]error while generating apk in android studio after gradle build is successfull
[英]Error while generating build apk file in my android studio
我正在嘗試在我的 android studio 中構建 apk 文件,但它生成了以下錯誤。
錯誤:任務“:app:transformClassesWithJarMergingForDebug”的執行失敗。
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重復條目:com/google/android/gms/common/api/zzd.class
如何擺脫這個問題並構建 apk 文件。
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.wedding.weddingapp"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
configurations { all*.exclude module: 'gson-2.5' }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/layerhq/releases-android/master/releases/" }
maven { url "https://raw.githubusercontent.com/layerhq/Atlas-Android/master/releases/" }
}
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.layer.atlas:layer-atlas:0.3.6'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.volley:volley:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:support-v4:24.2.1'
testCompile 'junit:junit:4.12'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
這可能是因為您必須使用舊版本的谷歌服務,請確保apply plugin: 'com.google.gms.google-services'
和com.google.firebase:firebase-messaging:9.8.0
是兼容的注意不要使用com.google.gms.google-services 9.0.0
請確保您使用的是 9.0.0 以上版本
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.