. Advertisement .
..3..
. Advertisement .
..4..
React Native is an open-source framework created by Facebook. This tool is used to develop Android, iOS, Web, and UWP mobile apps by allowing developers to use React and a native app environment.
When you ran your code, you encountered the following error: “react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only”.
As a result of our research, we will present workable alternative options to computer programmers without delay. Let’s get started on correcting this error.
Under what conditions will the error “react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only” occur?
When you recently ran my react native app, you discovered this error in your 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 Is The Error Going To Be Solved?
There are several different solutions to help you fix this error, here are 3 solutions
Method 1: Update The package.json
Here is a problem with the 7.2.* version. Try updating to the most recent version or any 7.3.* version. To update react-native-push-notification to the latest version, run the command below.
npm i [email protected]
Method 2: Update The package.json in another way
Upgrade to the most recent version. You can use the command “npm i [email protected]”.
Change also in android/build.gradle.
buildscript {
ext {
// ...
firebaseMessagingVersion = '21.1.0'
}
Method 3: Add the “type”: “module”
First, remove react-native-push-notification. Use the following command “npm uninstall react-native-push-notification”.
Then, reinstall react-native-push-notification. Using the following command. “npm i [email protected]”.
In defaultConfig, add the following code to android/app/build.gradle:
dexOptions {
javaMaxHeapSize "4g"
}
You also need to add: “implementation ‘com.google.firebase:firebase-messaging:21.1.0’.
In android/gradle.properties, add the following code:
firebaseMessagingVersion=21.1.0
Then you have to run npm install. You might have to run a yarn install and rebuild the project again with Android Studio.
Conclusion
The solutions presented above are suggestions for those still perplexed by the error “react-native-push-notification:compileDebugJavaWithJavac FAILED, using latest version only”.
If you still need assistance or have many ideas, we have a large community where everyone is usually willing to assist. Lastly, we’d like to commend everyone who has read this far and wish you a pleasant day of intriguing code solutions.
I solved this issue with the following methods
Install it back
And in the android/app/build.gradle
Also add: implementation ‘com.google.firebase:firebase-messaging:21.1.0’
In
android/gradle.properties
Then, run
npm install
.Again,
yarn install
&rebuild
withAndroid Studio
.Follow my suggestion below can help you a lot
1, Update the package of the npm.
Then, with cache -> clean it