evollu / react-native-fcm

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

FIRMessagingModule is not abstract and does not override abstract method onActivityResult #235

Open gijoehosaphat opened 7 years ago

gijoehosaphat commented 7 years ago

Using:

react-native: 0.39.0
react-native-fcm: 2.5.2

Building for Android (have not tested iOS):

/.../node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:36: error: FIRMessagingModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
public class FIRMessagingModule extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
       ^
/.../node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:274: error: method does not override or implement a method from a supertype
    @Override
    ^
/.../node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java:278: error: method does not override or implement a method from a supertype
    @Override
    ^
3 errors
:react-native-fcm:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

I've seen some other similar issues here (all closed) that seem to indicate different solutions, but they did not work in my case.

Note: in code above I replaced my local path with ... for privacy and brevity.

sibelius commented 7 years ago

do a clean android install, this looks like cached data

gijoehosaphat commented 7 years ago

Thanks @sibelius. What is your definition of a "clean" android install? My build process always performs a ./gradlew clean before running/building. I've also wiped my ~/.gradle/caches.

I should also add that I recently tried to upgrade from react-native-fcm: 2.0.0

biancaFarcas commented 7 years ago

I had the same problem and I was able to build successfully after removing parameter Activity activity from onActivityResult function.

skv-headless commented 7 years ago

I have same issue running react-native on master. Works fine when I switch back to stable version.

jeremyong commented 7 years ago

I ran into this too. If you follow the symbol declaration of ActivityEventListener, it most likely is referencing a java file in the ~/.gradle/caches folder. Nuking that folder and rebuilding should be sufficient.

ssomnoremac commented 7 years ago

I got this for a second time, first being #121, after upgrading my Android build tools. After running ./gradlew clean and removing ~/.gradle/caches I still get this exact error. I don't get it, because like @jeremyong says, the method clearly takes 4 arguments in the declaration.

ssomnoremac commented 7 years ago

I recently switched to my own RN fork so after going back to 37 stable I was able to build. Would like to know why this (and other libraries) @overrides seem not to work using a forked RN

jeremyong commented 7 years ago

@ssomnoremac I had to change for all my dependencies the included dependency from com.facebook.react to ReactAndroid in order to get things to work properly when developing off my fork of RN. What happens is that com.facebook.react tries to use a prebuilt binary and when not found, pulls off the latest from jcentral or some nonsense which is an ancient version.

ssomnoremac commented 7 years ago

@jeremyong, damn, that makes sense but is frustrating. Thanks! My fork was for an iOS patch so I'm just keeping android builds in a separate local repo without the fork. Will try out your suggestion soon!

skv-headless commented 7 years ago

https://github.com/facebook/react-native/issues/11677 there I put temporary solution.

dingbat commented 7 years ago

@jeremyong thanks, that's super useful! I tried doing something like that but don't think I did it properly, do you think you could be a bit more specific about how to do that workaround?

jeremyong commented 7 years ago
dependencies {
    compile (project(path: ':ReactAndroid')) {
        exclude group: 'com.facebook.react', module: 'react-native'
    }
}

Try using that in your dependency build.gradle files instead of com.facebook.react. Make sure for your own project you follow the instructions in https://facebook.github.io/react-native/docs/android-building-from-source.html

lucasbento commented 7 years ago

I'm having this same error on "react-native-fcm": "2.5.6" and "react-native": "0.39.2", there are multiple closed issues regarding that same problem, tried all the solutions mentioned and none of them worked.

Also tried downgrading react-native-fcm to 2.3.1, didn't work.

niftylettuce commented 7 years ago

same issue as @lucasbento cc @sibelius

sibelius commented 7 years ago

make sure the gradle config is ok

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
            }
        maven { url 'https://maven.fabric.io/public' }
    }
}

u can only have one url inside each maven

kseniamukhortova commented 7 years ago

Is there any working resolution other than interfering into the library code? Have the same issue react-native 0.42.3, react-native-fcm: 7.0.3