Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: RNFirebaseMessaging is not abstract and does not override #381

Closed
GH974 opened this issue Sep 1, 2017 · 11 comments
Closed

error: RNFirebaseMessaging is not abstract and does not override #381

GH974 opened this issue Sep 1, 2017 · 11 comments

Comments

@GH974
Copy link

GH974 commented Sep 1, 2017

Issue

:react-native-firebase:compileReleaseJavaWithJavac
/Users/gh.mbp974/Documents/DEV_SITE/quizzApp/appv2/quizz/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java:34: error: RNFirebaseMessaging is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
^
1 error
Incremental compilation of 2 classes completed in 0.402 secs.
:react-native-firebase:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-firebase: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

Total time: 6.337 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Environment

  1. Application Target Platform: ANDROID
  1. Development Operating System: MacosSierra 10.12.6
  1. Build Tools: Android Sdk tools 26.0.2
  1. React Native version: 0.47.2
  1. RNFirebase Version: 2.1.4
  1. Firebase Module: messaging
@Ehesp
Copy link
Member

Ehesp commented Sep 1, 2017

@Salakar how is this erroring? The abstract method has been there for over a year on RN!

https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java

@GH974
Copy link
Author

GH974 commented Sep 1, 2017

Is this my question? I don't know.
I install this plugins and follow your doc, and after i try react-native run-android and this error

@Ehesp
Copy link
Member

Ehesp commented Sep 1, 2017

Nope was asking Salakar!

@GH974 On your terminal, could you run react-native -v please and let us know the version of react-native-cli

Cheers

@GH974
Copy link
Author

GH974 commented Sep 1, 2017

Oh sorry...

react-native-cli: 2.0.1
react-native: 0.47.2

@Ehesp
Copy link
Member

Ehesp commented Sep 1, 2017

@GH974 Ta, could you navigate to /node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessaging.java

In there, could you check the onActivityResult exists for sanity please (should be at the bottom).

@GH974
Copy link
Author

GH974 commented Sep 1, 2017

@OverRide
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
// todo hmm?
}

@OverRide
public void onNewIntent(Intent intent) {
// todo hmm?
Utils.sendEvent(getReactApplicationContext(), "messaging_notification_received", parseIntent(intent));
}

@Ehesp
Copy link
Member

Ehesp commented Sep 1, 2017

Hi @GH974

Your projects RN version is out-dated, so here's why & how to fix:

Your RN versions ActivityEventListener is looking for the method: onActivityResult(int,int,Intent), which exists on RN versions <0.33:

https://github.com/facebook/react-native/blob/0.32-stable/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java

This was then changed in 0.33 to the current implementation of onActivityResult(Activity activity, int requestCode, int resultCode, Intent data).

I think that your gradle is not correctly looking at node_modules for React Native & is instead looking for React Native from the maven repository which is on v0.20.1 (https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.facebook.react%22) as they stopped publishing to maven in favour of node_modules.

Make sure your android/build.gradle has the following:

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.google.com"
        }
    }
}

@GH974
Copy link
Author

GH974 commented Sep 1, 2017

I have new error
Could not find com.google.firebase:firebase-ads:11.2.0.
Searched in the following locations:
file:/Users/gh.mbp974/Library/Android/sdk/extras/google/m2repository/com/google/firebase/firebase-ads/11.2.0/firebase-ads-11.2.0.pom
file:/Users/gh.mbp974/Library/Android/sdk/extras/google/m2repository/com/google/firebase/firebase-ads/11.2.0/firebase-ads-11.2.0.jar
file:/Users/gh.mbp974/Documents/DEV_SITE/quizzApp/testQuizz/AwesomeProject/android/sdk-manager/com/google/firebase/firebase-ads/11.2.0/firebase-ads-11.2.0

@Salakar
Copy link
Member

Salakar commented Sep 1, 2017

@GH974 from above screenshot:

image

@GH974
Copy link
Author

GH974 commented Sep 2, 2017

Yes I added this. thanks its works

@GustavoHGS
Copy link

Thanks a lot @Ehesp !! It worked like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants