如何解决多个dex文件定义了Lcom / google / android / gms / measurement / AppMeasurement;

时间:2019-02-27 06:48:11

标签: android build.gradle multidex android-multidex

这是我们的构建gradle模块:APP
  如何解决多个dex文件定义了Lcom / google / android / gms / measurement / AppMeasurement问题,请给我一些解决方案,下面列出所有依赖项,因此还有play-services和google-services,因此请给我解决方案

repositories {
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    android {
        compileSdkVersion 26
        buildToolsVersion "26.0.2"
        defaultConfig {
            applicationId 
            minSdkVersion 16
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            multiDexEnabled = true
        }
        dexOptions {
            jumboMode = true
            preDexLibraries = false
            javaMaxHeapSize "4g"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }

        lintOptions {
            abortOnError false
        }
        configurations{
            all*.exclude module:'gson'  //Remove duplicate dependencies: gson
        }

    }

    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 fileTree(include: ['*.jar'], dir: 'libs')
        compile project(':lib')
        compile project(':tablayoutsupport')
        //noinspection GradleCompatible
        compile 'com.android.support:appcompat-v7:26.1.0'
        compile 'com.android.support:multidex:1.0.3'
        compile 'com.android.support:design:26.1.0'
        compile 'com.android.support:support-v4:26.1.0'
        compile 'com.android.support:cardview-v7:26.1.0'
        compile 'com.github.bumptech.glide:glide:3.7.0'
        compile 'de.hdodenhof:circleimageview:1.3.0'
        compile 'de.hdodenhof:circleimageview:2.1.0'
        compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
        compile 'com.anthonycr.grant:permissions:1.0'
        compile 'com.auron:permission-manage:1.1.6'
        compile 'com.github.andyxialm:ColorDialog:1.0.0'
        compile 'com.anjlab.android.iab.v3:library:1.0.44'
        compile ('com.google.firebase:firebase-core:11.0.2'){
            force = true;
        }
        compile ('com.google.android.gms:play-services:8.4.0'){
            force = true;
            exclude module: 'support-v4'
        }

        compile 'com.squareup.picasso:picasso:2.71828'
        compile ('com.google.firebase:firebase-messaging:17.3.4') {
            force = true;
        }
        compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
        compile ('com.google.code.gson:gson:2.8.5'){
            force=true;
        }
        compile 'org.apache.commons:commons-lang3:3.5'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        testCompile 'junit:junit:4.12'
    }

这是build.gradle(项目)
        所以告诉我这个错误的解决方法是我如何成功安装它     顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项。     而且此build.gradle和应用程序未运行,那么解决方案是什么

 buildscript {
        ext.kotlin_version = '1.2.71'
        repositories {
            jcenter()
            mavenCentral()
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
            maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51"
            classpath 'com.google.gms:google-services:4.2.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }

    allprojects {
        repositories {
            jcenter()
            google()
            mavenCentral()
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

0 个答案:

没有答案