com.android.build.api.transform.TransformException: Error while generating the main dex list

眉间皱痕 提交于 2019-12-11 06:18:08

问题


I'm implementing react-native-firebase notifications lib in a react native project. here is my android gradle.build

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://maven.fabric.io/public' }
        flatDir {
            dirs 'libs'
        }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven { url "$rootDir/../node_modules/react-native/android" }
        maven { url "https://maven.google.com" }
        flatDir {
            dirs 'libs'
        }
    }
}

And app gradle.build

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation(project(':react-native-maps')) {
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

   implementation 'com.android.support:multidex:1.0.3'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation "com.android.support:appcompat-v7:27.1.0"
    implementation 'com.facebook.react:react-native:+'

    implementation(project(':react-native-firebase'))
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:16.0.1"
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

When generating build getting exception. I have played with changing version but same result. here is the exception

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

回答1:


In your app's gradle.build file add this implementation "com.android.support:design:27.1.0"



来源:https://stackoverflow.com/questions/52003413/com-android-build-api-transform-transformexception-error-while-generating-the-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!