1

问题

当我尝试在我的项目中配置 react-native-fcm 时出错。

FAILURE: Build failed with an exception. 
What went wrong:
Execution failed for task 
':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: Error while 
generating the main dex list.

版本

  1. 反应 v16.3.1
  2. 反应原生 v0.55.2
  3. react-native-fcm v14.1.3

设备

安卓 API 23

文件

我按照react-native-fcm中的步骤配置文件

顶级 build.gradle

...
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:3.0.0'
}
...

应用程序/build.gradle 文件

...
android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.cdan"
        minSdkVersion 16
        targetSdkVersion 25
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}
...
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation "com.facebook.react:react-native:+"
    implementation "com.android.support:multidex:1.0.2"

    implementation project(':realm')

    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.google.android.gms:play-services-base:10.0.1'
    implementation 'com.google.android.gms:play-services-maps:10.0.1'

    compile project(':react-native-fcm')
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'

}

...

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

我试过gradlew clean但它不起作用。

4

0 回答 0