Search code examples
javascriptandroidfirebasereact-nativereact-native-fcm

Build failing for android with error "Execution failed for task ':react-native-fcm:compileReleaseJavaWithJavac'.", but working for iOS


I am facing this issue with android release suddenly. Till Friday everything was working fine, but build is getting failed today with error. i have attached the detailed error in screenshot That is the error i am facing now for android build. working fine for iOS


Solution

  • I experienced similar error today, it is due to deprecation of certain firebase classes used by react-native-fcm. You can either rewrite the functions or do the below. Go to build.gradle for react-native-fcm and change it to look like the below code.

        dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.facebook.react:react-native:+'
        compile 'com.google.firebase:firebase-core:16.0.8'
        compile 'com.google.firebase:firebase-messaging:17.5.0'
        compile 'me.leolin:ShortcutBadger:1.1.17@aar'
    }
    

    By default gradle was getting the latest firebase-core and firebase-messaging (specified by +) and this was causing the error. Make sure to clean the project and re-build it.