evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 682 forks source link

Compile error - promise #1041

Closed ArthurKnoep closed 6 years ago

ArthurKnoep commented 6 years ago
  1. What version of RN and react-native-fcm are you running? RN: 0.56.0 / React-Native-FCM: 16.2.1
  2. What device are you using? (e.g iOS9 emulator, Android 6 device)? Android 8.0 device
  3. Is your app running in foreground, background or not running? Not compiling

When I create an react native app with react-native init and add react-native-fcm with npm, I cannot compile the projet with react-native run-android

Logs:

:react-native-fcm:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/arthur/Documents/node/react-native/ReactNotifTest2/node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:217: error: cannot find symbol
            promise.resolve(null);
            ^
  symbol:   variable promise
  location: class FIRMessagingModule
/home/arthur/Documents/node/react-native/ReactNotifTest2/node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:220: error: cannot find symbol
            promise.reject(null,e.getMessage());
            ^
  symbol:   variable promise
  location: class FIRMessagingModule
/home/arthur/Documents/node/react-native/ReactNotifTest2/node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:228: error: cannot find symbol
            promise.resolve(null);
            ^
  symbol:   variable promise
  location: class FIRMessagingModule
/home/arthur/Documents/node/react-native/ReactNotifTest2/node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:231: error: cannot find symbol
            promise.reject(null,e.getMessage());
            ^
  symbol:   variable promise
  location: class FIRMessagingModule
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors
:react-native-fcm:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-fcm:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Step to reproduce:

Ps: I'm a newbie to react native and firecloud

wynch commented 6 years ago

This change came from version 16.2.1....

You can fix that by changing your dependency in your package.json : "react-native-fcm" : "16.2.0" (important : remove the ^ to force this exact version)

FloPMT commented 6 years ago

@wynch Thank you that worked.

ArthurKnoep commented 6 years ago

@wynch Thanks a lot, it works now

wynch commented 6 years ago

The error comes from this file

https://github.com/evollu/react-native-fcm/blob/master/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java

the Method public void unsubscribeFromTopic(String topic)(line 225) signature should be public void unsubscribeFromTopic(String topic, Promise promise)

ArthurKnoep commented 6 years ago

Is this normal ?

evollu commented 6 years ago

fixed in 16.2.2