React-native-fcm: FIRMessagingModule is not abstract and does not override abstract method onActivityResult

Created on 15 Dec 2016  路  16Comments  路  Source: evollu/react-native-fcm

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.

question

Most helpful comment

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

All 16 comments

do a clean android install, this looks like cached data

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

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

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

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.

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.

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

@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.

@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!

@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?

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

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.

same issue as @lucasbento cc @sibelius

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

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

Was this page helpful?
0 / 5 - 0 ratings