react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Issue on Android : FirebaseMessaging.getInstance().getToken() and FirebaseMessaging.getInstance().deleteToken();

Open aditya-keri-betterhalf opened this issue 4 years ago • 11 comments
trafficstars

Question

My project was previously using the react-native-push-notification version 3.5.2. Today I upgraded the same to the latest version - 8.1.0. I also upgraded the @react-native-community/push-notification-ios to 1.10.1.

When I try to build the android app, I get the error : > Task :react-native-push-notification:compileDebugJavaWithJavac FAILED

The two main errors after this error are:

/Users/apple/Desktop/Push-Notifications/betterhalf-mobile-rn/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:140: error: cannot find symbol
      FirebaseMessaging.getInstance().getToken()
                                     ^
  symbol:   method getToken()
  location: class FirebaseMessaging
/Users/apple/Desktop/Push-Notifications/betterhalf-mobile-rn/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:283: error: cannot find symbol
      FirebaseMessaging.getInstance().deleteToken();
                                     ^
  symbol:   method deleteToken()
  location: class FirebaseMessaging

My firebase packages are as follows:

    "@react-native-firebase/app": "^10.0.0",
    "@react-native-firebase/crashlytics": "^10.0.0",
    "@react-native-firebase/in-app-messaging": "^10.0.0",
    "@react-native-firebase/messaging": "^10.0.0",
    "@react-native-firebase/perf": "^10.0.0",

Entire error log in gist : https://gist.github.com/aditya-keri-betterhalf/8b026335e442e9774c6960b4879c8f06

aditya-keri-betterhalf avatar Sep 22 '21 11:09 aditya-keri-betterhalf

hi @aditya-keri-betterhalf I have the same issue, how you solved it ?

Zeroxys avatar Oct 11 '21 16:10 Zeroxys

is it working ?

kukuandroid avatar Oct 25 '21 16:10 kukuandroid

same here

willnaoosmith avatar Nov 17 '21 13:11 willnaoosmith

What solved this issue for me was to upgrade the firebaseMessagingVersion.

vliedel avatar Nov 25 '21 10:11 vliedel

@vliedel which version did you use?

willnaoosmith avatar Dec 07 '21 12:12 willnaoosmith

I went from 19.0.1 to 21.1.0. See this commit: https://github.com/crownstone/crownstone-app/commit/fc1bc6505521ba0eb8fb739c516fef85983abe28

vliedel avatar Dec 07 '21 14:12 vliedel

it worked, thanks!

willnaoosmith avatar Dec 07 '21 18:12 willnaoosmith

What i need to do if i have to use firebaseMessagingVersion = 20.0.1?

romanravkov avatar Feb 07 '22 07:02 romanravkov

Same issue

erickcrus avatar Nov 30 '22 15:11 erickcrus

got the same issue, but solved it by upgrading firebaseMessagingVersion from 17.3.0 to 21.1.0

davmaene avatar Dec 04 '23 23:12 davmaene