davide-scalzo / react-native-mixpanel

A React Native wrapper for Mixpanel tracking
MIT License
455 stars 195 forks source link

Android Could not invoke RNMixpanel.sharedInstanceWithToken null #185

Open pjreact opened 5 years ago

pjreact commented 5 years ago

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

dancherb commented 5 years ago

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' }
Sathyanarayan09 commented 5 years ago

Same issue for me too after upgrading mixpanel to version 1.1.4

idoamram2gether commented 5 years ago

I'm using

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

instead of sharedInstanceWithToken and it works fine

krydos commented 5 years ago

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

Manhazito commented 4 years ago

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.

arnaudambro commented 3 years ago

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 ?

OrLevy23 commented 1 year ago

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

davide-scalzo commented 1 year ago

Sorry to hear that, the package has been deprecated for a couple of years. I'd suggest migrating to the official mixpanel sdk.

On Mon, 8 May 2023 at 16:40, Or @.***> wrote:

Hello there, I've just updated our apps react-native version and starting seeing this one in android(didn't update mixpanel version)

this is the error I'm seeing in release version as well

this prevents us from updating react native version

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>