React-native-fcm: Failed for task ':app:transformClassesWithMultidexlistForDebug'

Created on 23 Apr 2018  路  4Comments  路  Source: evollu/react-native-fcm

Issue

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.

Versions

  1. React v16.3.1
  2. react-native v0.55.2
  3. react-native-fcm v14.1.3

Device

Android API 23

Files

I follow step in react-native-fcm to config file

Top-level build.gradle

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

app/build.gradle file

```
...
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'

```

I tried gradlew clean but it not working.

Most helpful comment

How you solved the issue?

All 4 comments

How you solved the issue?

Is there any solution?

Any solution?

I think this problem because firebase version.
So I change version to fix this.

In /android/build.gradle

  dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.2' <--- Here
    }

In /android/app/build.gradle

compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 16
        targetSdkVersion 27 <--- Here
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.0" <--- Here
    implementation "com.facebook.react:react-native:+"

    implementation project(':react-native-fcm')
    implementation 'com.google.firebase:firebase-core' <--- Here
    implementation 'com.google.firebase:firebase-messaging' <--- Here
}
Was this page helpful?
0 / 5 - 0 ratings