close

[Solved] How to solve Task :react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only

Hello Guys, How are you all? Hope You all Are Fine. Today I Found react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only Error in React Native. So Here I am Explain to you all the possible solutions here.

Without Wasting your time, Lets start This Article to Solve This Error.

How Task :react-native-push-notification:compileDebugJavaWithJavac FAILED , using latest version only Occurs ?

Advertisements

Today When I Run my react native app I Found this error in my stack track. Task :react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only

![\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:40: error: cannot find symbol

import com.google.firebase.iid.InstanceIdResult

How To Solve react-native-push-notification:compileDebugJavaWithJavac FAILED Error ?

Question: How To Solve react-native-push-notification:compileDebugJavaWithJavac FAILED Error ?
Answer: There is some issue at 7.2.* version. Try moving to the latest version or any 7.3.* version. try this Command npm I react-native-push-notification@latest. then change in android/build.gradle.

Solution 1

  1. Update to latest version. Using Below Command.
  2. npm i react-native-push-notification@latest
  3. Also Change in android/build.gradle.
buildscript {
 ext {
      //  ...
     firebaseMessagingVersion = '21.1.0'
 }

Solution 2

Here Is some problem in 7.2.* version. Try moving to the latest version or any 7.3.* version. Use the below command to update react-native-push-notification to the latest version.

npm i react-native-push-notification@latest

Solution 3

  • First Uninstall react-native-push-notification. Use the below command.
  • npm uninstall react-native-push-notification
  • Then reinstall react-native-push-notification By using the below command.
  • npm i react-native-push-notification@latest
  • In android/app/build.gradle, add the following code in defaultConfig :
dexOptions {
            javaMaxHeapSize "4g"
        }
  • Also add: implementation ‘com.google.firebase:firebase-messaging:21.1.0’
  • In android/gradle.properties, add the following code: firebaseMessagingVersion=21.1.0
  • Then Just run npm install. You might have to run yarn install and rebuild your project again with Android Studio as well.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment