当我使用Adobe Creative SDK时,我在构建APK时遇到以下错误。
错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / iid / zzc.class
当我将minSdkVersion切换为21时,它会成功创建APK。我需要这个应用程序在至少版本19上运行。
我的build.gradle文件是:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
/* 1) Apply the Gradle Retrolambda Plugin */
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId 'com.example.myapp'
minSdkVersion 20
targetSdkVersion 25
versionCode 10
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [appPackageName: "${applicationId}"]
multiDexEnabled true
dexOptions {
jumboMode true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
splits {
// Split apks on build target ABI, view all options for the splits here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
abi {
enable true
reset()
include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'x86', 'x86_64'
}
}
/* 2) Compile for Java 1.8 or greater */
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/* 3) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
}
android {
lintOptions {
disable 'MissingTranslation'
}
}
productFlavors {
}
}
ext.versionCodes = ['armeabi': 10, 'armeabi-v7a': 11, 'arm64-v8a': 12, mips: 13, 'x86': 14, 'x86_64': 15]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 1000 + android.defaultConfig.versionCode
}
}
repositories {
jcenter()
maven { url "http://kodbiro.github.io/repo/" }
maven { url "https://jitpack.io" }
}
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 project(':kbimageview')
compile project(':PGSDK_V2.0')
compile project(':cropper')
compile project(':matisse')
/* 4) Add the CSDK framework dependencies (Make sure these version numbers are correct) */
/* Add the CSDK framework dependencies (Make sure these version numbers are correct) */
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'gun0912.ted:tedpermission:1.0.3'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.kaopiz:kprogresshud:1.1.0'
compile 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
compile 'com.valdesekamdem.library:md-toast:0.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
compile 'com.firebase:firebase-jobdispatcher:0.7.0'
compile 'me.everything:overscroll-decor-android:1.0.4'
compile 'com.synnapps:carouselview:0.1.4'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.github.florent37:viewanimator:1.0.5'
compile 'com.github.wooplr:Spotlight:1.2.3'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:3.8.0'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
//https://stackoverflow.com/questions/45346959/duplicate-entry-com-google-android-gms-iid-zzc-class
apply plugin: 'com.google.gms.google-services'
gradlew app:dependencies
的输出是(由于输出非常大,因此无法将其粘贴到此处):
https://1drv.ms/t/s!AhQ7CrkhMU-0hs5kp4b2xPm5rUvoVw
答案 0 :(得分:0)
我通过从creativesdk中排除com.google.android.gms
解决了这个问题,请使用下面的代码:
compile ('com.adobe.creativesdk:image:4.8.4') {
exclude group: 'com.google.android.gms'
}