Android React-Native react-native-push-notification:compileDebugJavaWithJavac Failure

Viewed 731

After some breaking changes by Firebase on 11 may 2021. I am facing this error react-native-push-notification:compileDebugJavaWithJavac FAILED.
Below I am sharing following points about dependencies and its versions.

react-native-push-notification": "^6.1.1"  
@react-native-firebase/messaging": "7.9.0",  
"@react-native-firebase/app": "8.4.5",  
buildscript {  
ext {  
    buildToolsVersion = "28.0.3"  
    minSdkVersion = 16  
    compileSdkVersion = 29  
    targetSdkVersion = 29  
    supportLibVersion = "28.0.0"   
    googlePlayServicesAuthVersion = "16.0.1"
}

enter image description here

1 Answers

It is just the issue with the Android Gradle, since the FirebaseInstanceId is deprecated, hence, Android fails while doing the build. For solving this out you can do these, and your app will come back to normal.

  • Add implementation 'com.google.firebase:firebase-messaging:21.1.0' to android/app/build.gradle. Please note if you already have implementation 'com.google.firebase:firebase-messaging', make sure to comment it, and add which is mentioned in the answer.
  • Add firebaseMessagingVersion=21.1.0 to android/gradle.properties.

After that, clean the Android Project by doing cd android && ./gradlew clean on Mac or cd android && gradlew clean on Windows project from terminal, and then run the app using npm run android.

Related