无法合并Dex错误 - 如何搜索重复的依赖项?

时间:2017-12-18 16:07:20

标签: android firebase gradle

我怀疑问题是firebase-firestorefirebase-ui-auth之间的某些依赖性冲突,也许是一些gms库。如果我从我的应用中删除firebase-ui-auth相关性,则错误消失,但如果我添加com.android.billingclient:billing:1.0则会再次显示。

我的应用build.gradle

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'androiddebugkey'
            storeFile file('xxx')
            storePassword 'xxx'
        }
    }
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.xxx"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
}

dependencies {
    implementation 'com.android.support:support-vector-drawable:26.1.0'
    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.android.support:appcompat-v7:26.1.0'
    compile 'com.xenione.libs:swipe-maker:1.1.3'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:design:26.1.0'
    //compile 'com.google.firebase:firebase-core:11.6.2'
    compile 'com.google.firebase:firebase-firestore:11.4.2'
    //compile 'com.google.firebase:firebase-auth:11.4.2'
    compile' com.firebaseui:firebase-ui-auth:3.1.0'


    compile 'com.android.billingclient:billing:1.0'
    compile 'org.projectlombok:lombok:1.16.18'
    compile 'net.danlew:android.joda:2.9.9'
    compile 'com.github.StephenVinouze:MaterialNumberPicker:1.0.4'
    compile 'uk.co.chrisjenx:calligraphy:2.3.0'
    compile 'com.github.fondesa:lyra:1.0.1'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'org.projectlombok:lombok:1.16.18'
}
apply plugin: 'com.google.gms.google-services'

我的项目build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository

        }
        maven{
            url "https://jitpack.io"
        }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

项目构建失败。错误:

    FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/android/vending/billing/IInAppBillingService;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 29s

如何进一步解决这个问题以及正确的build.gradle会是什么样子?

0 个答案:

没有答案