4

I'm getting the following exception when trying to use Answers on Unity3d:

Notice that I'm using the Automatic initialization of Fabric ,it works fine with Crashlytics but with Answers - not. (I'm calling Answers.LogCustom() function and very long time after the app was started (1 minute after, to be exact).

What can be done?

java.lang.IllegalStateException: Must Initialize Fabric before using singleton()
io.fabric.sdk.android.Fabric.singleton(Fabric.java:273)
io.fabric.sdk.android.Fabric.getKit(Fabric.java:524)
com.crashlytics.android.answers.Answers.getInstance(Answers.java:32)
com.unity3d.player.UnityPlayer.nativeRender(Native Method)
com.unity3d.player.UnityPlayer.c(Unknown Source)
com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source)
android.os.Handler.dispatchMessage(Handler.java:98)
android.os.Looper.loop(Looper.java:154)
com.unity3d.player.UnityPlayer$c.run(Unknown Source)
UnityEngine.AndroidJNISafe.CheckException () (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) (at <00000000000000000000000000000000>:0)
UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
Fabric.Answers.Internal.AnswersSharedInstanceJavaObject..ctor () (at <00000000000000000000000000000000>:0)
Fabric.Answers.Internal.AnswersAndroidImplementation..ctor () (at <00000000000000000000000000000000>:0)
Fabric.Answers.Answers.get_Implementation () (at <00000000000000000000000000000000>:0)
Fabric.Answers.Answers.LogCustom (System.String eventName, System.Collections.Generic.Dictionary`2[TKey,TValue] customAttributes) (at <00000000000000000000000000000000>:0)
Tomer Peled
  • 3,571
  • 5
  • 35
  • 57
  • Fabric is initialized in android's Application.onCreate. To do so, fabric plugin on unity writes it's own application (FabricApplication) class in AndroidManifest.xml in tag. Just an assumptution: some other plugin replaced that entry in manifest. To fix that - call init yourself as early as possible – Deepscorn Oct 09 '17 at 08:57
  • 1
    Not sure if this is related to unity3d but if you used `android:process`, you should probably check out [this answer](https://stackoverflow.com/a/51303563/2245107). – Mygod Jul 12 '18 at 10:42
  • Cool, I'll look on it – Tomer Peled Jul 12 '18 at 11:05
  • Any solution. I have migrated from Fabric to Firebase – sejn Sep 03 '20 at 11:37

0 Answers0