React-native-firebase: Could not invoke RNFirebaseMessaging.subscribeToTopic

Created on 25 Jun 2018  路  10Comments  路  Source: invertase/react-native-firebase

I have this problem: when calling method subscribeToTopic or unsubscribeToTopic this error prompts.
I mention that i have used methods from firebase.messaging() like request permissions and also received a notification sent from console.
Tried changing versions of dependencies in build.gradle in many ways, and nothing.

screenshot_1529946788

build.gradle:

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:23.0.1"
implementation "com.facebook.react:react-native:+"

implementation project(':react-native-firebase')

implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-auth:15.1.0"
implementation "com.google.firebase:firebase-functions:16.0.1"

implementation(project(":react-native-google-signin")){         
    exclude group: "com.google.android.gms"
}
implementation(project(':react-native-maps')){
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation project(':react-native-vector-icons')
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation "com.google.firebase:firebase-firestore:15.0.0"
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

}

  1. Application Target Platform:

Windows

  1. Development Operating System:

Android api 23

  1. Build Tools:
  1. React Native version:

0.54.2

  1. RNFirebase Version:

"react-native-firebase": "^4.2.0",

  1. Firebase Module:

Most helpful comment

Hi all,

Please see the versions of the SDK's listed on the v4.3.0 release notes - these have been tested to work; https://github.com/invertase/react-native-firebase/releases/tag/v4.3.0 and should solve this issue if matched up correctly.

Thanks!

All 10 comments

I am having the same issue after updating.
This commit is the problem.
By matching the version I am using with this, it started to work again

https://github.com/invertase/react-native-firebase/commit/dae0645006bc732480731731909547b86448905a

@wasedaigo
After updating what?
What version do you use?

I mean, after updating the version of react-native-firebase, I started to have the same issue. To fix the problem I needed to modify build.gradle of my Android project.

I think firebase-messaging needs to be 17.0.0 as in this commit https://github.com/invertase/react-native-firebase/commit/dae0645006bc732480731731909547b86448905a

I've change all my dependencies as those in the commit, still same issue.
Have you made any other changes?
Can you share your build.gradle?

dependencies {
    implementation project(':react-native-iap')
    implementation project(':react-native-firebase')
    implementation project(':react-native-exit-app')
    implementation project(':react-native-device-info')
    implementation project(':react-native-sound')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
    implementation "com.google.firebase:firebase-core:16.0.1"
    implementation "com.google.firebase:firebase-ads:15.0.1"
    implementation "com.google.firebase:firebase-analytics:16.0.1"
    implementation "com.google.firebase:firebase-messaging:17.0.0"
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

    implementation(name: 'unity-ads', ext: 'aar')
    implementation(name: 'mobile', ext: 'aar')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.facebook.react:react-native:0.55.3"  // From node_modules
}

still not working

Hey, any of yall got it working? I am still unable to get it to work.

my build.grade

implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.firebase:firebase-storage:15.0.2"

I got this issue also. I tried to use from 17.0.0 to 17.1.0 still getting the error. is the command change? I tried also 15.0.2 and still not working.

Hi there, i just managed to solve this problem. @eggybot

I opened Android Studio and look for react-native-firebase gradle file.

i updated the dependencies to

 compileOnly "com.google.android.gms:play-services-base:15.0.1"
  compileOnly "com.google.firebase:firebase-ads:15.0.1"
  compileOnly "com.google.firebase:firebase-auth:16.0.1"
  compileOnly "com.google.firebase:firebase-config:16.0.0"
  compileOnly "com.google.firebase:firebase-core:16.0.0"
  compileOnly "com.google.firebase:firebase-crash:16.0.0"
  compileOnly "com.google.firebase:firebase-database:16.0.1"
  compileOnly "com.google.firebase:firebase-firestore:17.0.1"
  compileOnly "com.google.firebase:firebase-functions:16.0.1"
  compileOnly "com.google.firebase:firebase-invites:16.0.0"
  compileOnly "com.google.firebase:firebase-storage:15.0.2"
  compileOnly "com.google.firebase:firebase-messaging:17.0.0"
  compileOnly "com.google.firebase:firebase-perf:16.0.0"
  compileOnly 'me.leolin:ShortcutBadger:1.1.21@aar'

Hi all,

Please see the versions of the SDK's listed on the v4.3.0 release notes - these have been tested to work; https://github.com/invertase/react-native-firebase/releases/tag/v4.3.0 and should solve this issue if matched up correctly.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings