5

我将 Digits 移动 sdk 集成到我的项目中,它不再构建。它与我正在使用的 gson 库有某种冲突。我在构建过程中收到此错误:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/gson/Gson$5.class

这是我的 build.gradle

buildscript {
    repositories {maven { url 'https://maven.fabric.io/public' }}
    dependencies {classpath 'io.fabric.tools:gradle:1.+'}}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.0"
    defaultConfig {...}
    buildTypes {release {...}}
    dexOptions {preDexLibraries = false
    incremental true
    javaMaxHeapSize "4g"}
    packagingOptions {...}}
repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }}
dependencies {
    ...
    compile('com.crashlytics.sdk.android:crashlytics:2.2.4@aar') {
        transitive = true;}
    compile 'io.branch.sdk.android:library:1.5.5'
    compile('com.digits.sdk.android:digits:1.5.0@aar') {
        transitive = true;}}
4

1 回答 1

6

这是解决方案

compile('com.digits.sdk.android:digits:1.5.0@aar') {
    transitive = true;
    exclude module: 'gson';
}

你需要添加排除模块:'gson'

于 2015-06-29T08:45:53.327 回答