mixpanel / mixpanel-unity

Official Unity Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
43 stars 40 forks source link

Can't load library on Oculus Quest #68

Closed shafy closed 2 years ago

shafy commented 5 years ago

When running it on my Oculus Quest device, I get the following error message:

Unable to load library '/data/app/com.mypackge/lib/arm/libMixpanelSDK.so', native render plugin support disabled: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.ClassLoader java.lang.Class.getClassLoader()' on a null object reference

Is Oculus Quest not supported at the moment or am I missing something?

shafy commented 5 years ago

Also, maybe related, requiring Mixpanel led to scenes not unloading after a scene change.

rocktavious commented 5 years ago

@shafy The original version of the library only support, iOS, Android, and Standalone build types. I've been working on a rewrite of the library (that is written in pure c# which should allow it to work on ANY platform that Unity can build to) that i'm trying to get Mixpanel to adopt - maybe you could try it out and see if it fixes your problem? https://github.com/mixpanel/mixpanel-unity/tree/release/2.0 (I have not tried it on Oculus Quest but would love to know if it does or doesn't work)

shafy commented 5 years ago

Hey @rocktavious just tested it and it looks like it's working :-) Great job, thanks! There was one error that I needed to fix though. In MixpanelSettingsEditor.cs, line 12 should be

var provider = new SettingsProvider("Project/Mixpanel", SettingsScope.Project)

You were missing the second argument, which is required.

So, is this going to be the official 2.0 release soon?

Edit: FYI Default Mobile Event Collection doesn't work, but I guess that's by design?

Edit 2: Tracking a Timed Event that is called when the application is about to quit OnApplicationQuit() also doesn't work. Goal is to track session length. Any ideas? :-)

rocktavious commented 5 years ago

@shafy Thanks for trying and i'm glad its working for you. I'll make that code change in MixpanelSettingsEditor

I'm working with Mixpanel to get this 2.0 version accepted at the official version of the library. I don't have an ETA on when that will be but keep you eyes posted to this github project.

As for the Default Mobile Event Collection i'll bring that up with them next time I have a meeting with them. The old version of the Unity SDK had a number of differences as compared to Mixpanel's other SDKs - Part of the work i'm helping them with is to bring the Unity SDK inline with the other SDKs.

As for the Timed Event OnApplicationQuit that is an interesting edge case i'll have to do some more testing - but gut guess there is its a script exection ordering problem. In the new version of the library I have a MonoBehaviour that does all the API calls to Mixpanel and it also listens for OnApplicaitonQuit - my guess is that your script listening for that happens AFTER the MixpanelManager which has already received that event and shut everything down. I would want to do some more testing but changing the ScriptExecutionOrder of the MixpanelManager to be "last" or "later" then the script your doing the tracking with might fix it. I also only call Mixpanel.Save(); in that OnApplicationQuit function so it may be that you just need to call Mixpanel.Flush(); in your to actually flush the queued events to the Mixpanel API.

Cheers and thanks for testing!

rocktavious commented 5 years ago

@shafy fixed in https://github.com/mixpanel/mixpanel-unity/commit/4a956a36461487ef56a42f71b920fdd84ed8dbf5

I'm going to mark this as fixed in 2.0 and I'll make a ticket for the OnApplicationQuit an you let me know what the outcome on your side for that is. I'll try to get some testing done after I finish the rest of the 2.0 work Mixpanel wants.

shafy commented 5 years ago

Alright, thanks! I will have time to try it today or tomorrow, will let you know here.

rocktavious commented 5 years ago

@shafy Did it work out?

shafy commented 5 years ago

Hey, sorry I forgot to answer and then started to focus on other things, haha.

Changing the execution order didn't work, although I'm not sure if I did it correctly so it would be good if you also tested it. I didn't test calling Mixpanel.Flush(); in my OnApplicationQuit yet, maybe that could work.

I'm traveling currently and will only be able to test it again in about 2 weeks. Let me know if you get to it earlier :-)

shafy commented 4 years ago

Alright got to test it finally, and couldn't get either of the solutions to work (changing execution order, calling Mixpanel.Flush() in my OnApplicationQuit(). Any ideas?

zihejia commented 2 years ago

The issue should be addressed already in #135 , please feel free to reopen if the problem still exists.