我尝试在项目中配置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.
Android 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'
}
...
app / 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
,但它没有用。