davide-scalzo/react-native-mixpanel

Android Could not invoke RNMixpanel.sharedInstanceWithToken null

Opened this issue · 8 comments

Screen Shot 2019-07-02 at 7 24 21 PM

Android Could not invoke RNMixpanel.sharedInstanceWithToken

null

No virtual method getInstanceId()Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/iid/FirebaseInstanceId; or its super classes (declaration of 'com.google.firebase.iid.FirebaseInstanceId' appears in /data/app/com.r25g.upliftv2-cVMqx0aibPnCfWmJLn_7_g==/base.apk)
invoke
JavaMethodWrapper.java:383
invoke
JavaModuleWrapper.java:158
run
NativeRunnable.java
handleCallback
Handler.java:789
dispatchMessage
Handler.java:98
dispatchMessage
MessageQueueThreadHandler.java:29
loop
Looper.java:164
run
MessageQueueThreadImpl.java:232
run
Thread.java:764

Getting a similar issue:

{ [TypeError: undefined is not a function (evaluating 'RNMixpanel.addPushDeviceToken(token, this.apiToken)')]
  line: 96785,
  column: 45,
  sourceURL: 'http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false' }

Same issue for me too after upgrading mixpanel to version 1.1.4

I'm using

const mixpanel = new MixpanelInstance(TOKEN)
await mixpanel.initialize()

instead of sharedInstanceWithToken and it works fine

@idoamram2gether thanks for suggestion. Doesn't work for me unfortunately.

I noticed that if I press "reload" after this error is appeared then everything works fine. So I see this error only on first run of the app (which is still critical though).

EDIT:
seems resolved for me.
I found this issue in native mixpanel-android package. Maybe comments there may be useful for someone.

In my case I had to add

implementation 'com.google.firebase:firebase-messaging:17.3.4' // Must be higher than 16.2.0

to my app/build.gradle file (I didn't have firebase there at all but for some reason my push notifications were working fine, I have to check this on my end and it's not related to this fix).
Actually instruction to add this line is here and README file points to it.

I also added my backend FCM token to mixpanel's application. I didn't test if the fix above works without this token in mixpanel, so I'm not sure if it's required step.

My project uses react-native-mixpanel version 1.1.4. I started seeing this error just today when I updated the library to version 1.1.10…

I'm already using implementation 'com.google.firebase:firebase-messaging:17.3.4', and using

const mixpanel = new MixpanelInstance(TOKEN)
await mixpanel.initialize()

instead of sharedInstanceWithToken(TOKEN) does not work: I get another error saying Mixpanel was not initialised.

Forcing version 1.1.4 fixes it for me.

hey guys

I don't know why, I've been developing with this lib for the last two years, and today the bug is happening

My project uses react-native-mixpanel version 1.1.4. I started seeing this error just today when I updated the library to version 1.1.10…

I'm already using implementation 'com.google.firebase:firebase-messaging:17.3.4', and using

const mixpanel = new MixpanelInstance(TOKEN)
await mixpanel.initialize()

instead of sharedInstanceWithToken(TOKEN) does not work: I get another error saying Mixpanel was not initialised.

Forcing version 1.1.4 fixes it for me.

this solution doesn't work, because it's not even provided by this lib, or am I wrong ?

Hello there, I've just updated our apps react-native version and starting seeing this one in android(didn't update mixpanel version)
image
this is the error I'm seeing in release version as well
image

this prevents us from updating react native version