smartlook / smartlook-android-sdk

5 stars 1 forks source link

[Unity][Android] Crash when recording an event #27

Closed Sh3rawi closed 5 years ago

Sh3rawi commented 5 years ago

Hey Guys, Just integrated smartlook into our Unity game today, the video recording is fine, but when i try to record a custom event it crashes

Stacktrace:

07-29 16:48:18.647 17218 17268 E Unity   : AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='track' signature='(Ljava/lang/String;Ljava/lang/String;)V' in class Ljava.lang.Object;
07-29 16:48:18.647 17218 17268 E Unity   : java.lang.NoSuchMethodError: no static method with name='track' signature='(Ljava/lang/String;Ljava/lang/String;)V' in class Ljava.lang.Object;
07-29 16:48:18.647 17218 17268 E Unity   :  at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source:167)
07-29 16:48:18.647 17218 17268 E Unity   :  at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
07-29 16:48:18.647 17218 17268 E Unity   :  at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
07-29 16:48:18.647 17218 17268 E Unity   :  at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
07-29 16:48:18.647 17218 17268 E Unity   :  at android.os.MessageQueue.next(MessageQueue.java:395)
07-29 16:48:18.647 17218 17268 E Unity   :  at android.os.Looper.loop(Looper.java:160)
07-29 16:48:18.647 17218 17268 E Unity   :  at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
07-29 16:48:18.647 17218 17268 E Unity   :   at UnityEngine._AndroidJNIHelper.GetMethodID (System.IntPtr jclass, System.String methodName, System.String signature, System.Boolean isStatic) [0x00041] in <2762122e55ea4a62914742efaba44784>:0
07-29 16:48:18.647 17218 17268 E Unity   :   at UnityEngine.AndroidJNIHelper.GetMethodID (System.IntPtr javaClass, System.String methodName...
adamblack commented 5 years ago

Hi @Sh3rawi ,

could you please provide an example of how you call RecordEvent method from our bridge?

Sh3rawi commented 5 years ago

@adamblack We have a helper class for sending events to our tracking tools, an example:

    public static void SendEvent(string eventName, JObject args) {
      #if !UNITY_EDITOR && !DEVELOPMENT_BUILD
      Kochava.Tracker.SendEvent("eventName", args.ToString());
      Dictionary<string, object> results = JsonConvert.DeserializeObject<Dictionary<string, object>>(args.ToString());
      Answers.LogCustom(eventName, results);
      List<string> k = args.Properties().Select(p => p.Name).ToList();
      List<JToken> v = args.Properties().Select(p => p.Value).ToList();
      Parameter[] parameters = new Parameter[args.Count];
      for(int i = 0; i < args.Count; i++) {
        parameters[i] = new Parameter(k[i], v[i].ToString());
      }
      FirebaseAnalytics.LogEvent(eventName, parameters);
      SmartLook.RecordEvent(eventName, args.ToString());
      #endif
    }
adamblack commented 5 years ago

My mistake @Sh3rawi , sorry about that. Please, try this version and let me know: https://sdk.smartlook.com/android/app-1.0.2-unity.aar

Sh3rawi commented 5 years ago

@adamblack its okay , no worries. With this new version i can confirm the events are working properly, but the video recording is now broken, it only shows the splash screen of unity, and then goes all black(but still records the user's interactions), so i thought maybe sensitive mode is on by default, i explicitly turned off sensitive mode after init but to no avail - still black screen

adamblack commented 5 years ago

@Sh3rawi We are going to release new version probably today that is going to address this issue. BTW, just to be sure, do you have any native overlay on top the game, maybe some other SDK handling something? We are recording native popups as well so I am wondering if there is no i.e. translucent overlay? If not, issue with black recording is going to be fixed.

Sh3rawi commented 5 years ago

@adamblack thanks man, nope we only have analytics stuff, facebook and admob, nothing else. Ill be waiting for the version then

adamblack commented 5 years ago

@Sh3rawi New version is up: https://smartlook.github.io/docs/sdk/unity/

In case you still have an issue regarding the black screen, would be willing to give me a list of your dependencies so I could test the same configuration on my side?

Sh3rawi commented 5 years ago

@adamblack thanks! i tried the new version and seems everything is alright, recordings and events