1

I'm trying to get Firebase working in Unity and not having a lot of luck. Shortly after calling the init function I get the following native exception:

2020-01-16 09:32:09.207 : java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI CallStaticObjectMethodV called with pending exception java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.firebase.iid.FirebaseInstanceId.zzh()' on a null object reference
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at boolean com.google.firebase.messaging.FirebaseMessaging.isAutoInitEnabled() (com.google.firebase:firebase-messaging@@20.0.1:7)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at boolean com.unity3d.player.UnityPlayer.nativeRender() ((null):-2)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at boolean com.unity3d.player.UnityPlayer.c(com.unity3d.player.UnityPlayer) ((null):-1)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at boolean com.unity3d.player.UnityPlayer$e$2.queueIdle() ((null):-1)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:405)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at void android.os.Looper.loop() (Looper.java:178)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]   at void com.unity3d.player.UnityPlayer$e.run() ((null):-1)
2020-01-16 09:32:09.207 : java_vm_ext.cc:570] 
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]     in call to CallStaticObjectMethodV
2020-01-16 09:32:09.207 : java_vm_ext.cc:570]     from boolean com.unity3d.player.UnityPlayer.nativeRender()
2020-01-16 09:32:09.488 : runtime.cc:630] Runtime aborting...
2020-01-16 09:32:09.488 : runtime.cc:630] Dumping all threads without mutator lock held
2020-01-16 09:32:09.488 : runtime.cc:630] All threads:
2020-01-16 09:32:09.488 : runtime.cc:630] DALVIK THREADS (25):
2020-01-16 09:32:09.488 : runtime.cc:630] "UnityMain" prio=5 tid=17 Runnable
2020-01-16 09:32:09.488 : runtime.cc:630]   | group="" sCount=0 dsCount=0 flags=0 obj=0x13040a60 self=0x7c50352800
2020-01-16 09:32:09.488 : runtime.cc:630]   | sysTid=25703 nice=0 cgrp=default sched=0/0 handle=0x7be5c19d50
2020-01-16 09:32:09.488 : runtime.cc:630]   | state=R schedstat=( 11202777646 885654308 16051 ) utm=1022 stm=97 core=7 HZ=100
2020-01-16 09:32:09.488 : runtime.cc:630]   | stack=0x7be5b17000-0x7be5b19000 stackSize=1039KB
2020-01-16 09:32:09.488 : runtime.cc:630]   | held mutexes= "abort lock" "mutator lock"(shared held)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #00 pc 00000000004109bc  /apex/com.android.runtime/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #01 pc 00000000004f8114  /apex/com.android.runtime/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool, BacktraceMap*, bool) const+512)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #02 pc 0000000000512a50  /apex/com.android.runtime/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+828)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #03 pc 000000000050b874  /apex/com.android.runtime/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+456)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #04 pc 000000000050ad58  /apex/com.android.runtime/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool)+1964)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #05 pc 00000000004b80f0  /apex/com.android.runtime/lib64/libart.so (art::Runtime::Abort(char const*)+1452)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #06 pc 000000000000b458  /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+580)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #07 pc 00000000003771bc  /apex/com.android.runtime/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1584)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #08 pc 00000000003773e0  /apex/com.android.runtime/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #09 pc 0000000000369808  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+136)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #10 pc 00000000003682dc  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+1144)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #11 pc 00000000003676c4  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+652)
2020-01-16 09:32:09.488 : runtime.cc:630]   native: #12 pc 000000000036c714  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CheckCallArgs(art::ScopedObjectAccess&, art::(anonymous namespace)::ScopedCheck&, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, art::InvokeType, art::(anonymous namespace)::VarArgs const*)+132)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #13 pc 000000000036b604  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+712)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #14 pc 000000000035b1f8  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::CheckJNI::CallStaticObjectMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+76)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #15 pc 0000000000189004  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libFirebaseCppApp-6_8_1.so (_JNIEnv::CallStaticObjectMethod(_jclass*, _jmethodID*, ...)+92)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #16 pc 0000000000210548  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libFirebaseCppApp-6_8_1.so (firebase::App::RegisterLibrary(char const*, char const*)+44)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #17 pc 000000000283098c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #18 pc 0000000002837fd8  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #19 pc 0000000002836024  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #20 pc 0000000002b60434  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #21 pc 0000000002dcc600  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #22 pc 00000000017eccbc  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #23 pc 00000000017eccbc  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #24 pc 000000000105d328  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #25 pc 0000000000f0deb8  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #26 pc 0000000000ca11f0  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)+140)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #27 pc 0000000000caf10c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)+84)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #28 pc 0000000000cb9e50  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingExceptionPtr*)+1192)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #29 pc 0000000000cb9f40  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr)+72)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #30 pc 0000000000cb8e3c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (MonoBehaviour::DelayedStartCall(Object*, void*)+88)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #31 pc 000000000092c2bc  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (DelayedCallManager::Update(int)+516)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #32 pc 0000000000abb924  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv+52)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #33 pc 0000000000ab2710  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*)+80)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #34 pc 0000000000ab276c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*)+172)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #35 pc 0000000000ab294c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (PlayerLoop()+244)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #36 pc 0000000000d235cc  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (UnityPlayerLoop()+556)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #37 pc 0000000000d33434  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (nativeRender(_JNIEnv*, _jobject*)+72)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #38 pc 000000000013f350  /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #39 pc 0000000000136334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #40 pc 0000000000144fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #41 pc 00000000002e27fc  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #42 pc 00000000002dda5c  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #43 pc 00000000005a20a8  /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+424)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #44 pc 0000000000130914  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #45 pc 00000000002bc7f8  [anon:dalvik-classes2.dex extracted in memory from /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/base.apk!classes2.dex] (com.unity3d.player.UnityPlayer.c)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #46 pc 00000000005a2af0  /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+1040)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #47 pc 0000000000130994  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #48 pc 00000000002bbf74  [anon:dalvik-classes2.dex extracted in memory from /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/base.apk!classes2.dex] (com.unity3d.player.UnityPlayer$e$2.queueIdle+144)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #49 pc 00000000002b3b10  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.4832201456133535214+240)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #50 pc 00000000005912e8  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #51 pc 000000000013f468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #52 pc 000000000200e09c  /memfd:/jit-cache (deleted) (android.os.MessageQueue.next+972)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #53 pc 0000000000136334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #54 pc 0000000000144fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #55 pc 00000000002e27fc  /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #56 pc 00000000002dda5c  /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #57 pc 000000000059fd80  /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+648)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #58 pc 0000000000130814  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #59 pc 0000000000344efe  /system/framework/framework.jar (android.os.Looper.loop+130)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #60 pc 00000000005a2af0  /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+1040)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #61 pc 0000000000130994  /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #62 pc 00000000002bc1d0  [anon:dalvik-classes2.dex extracted in memory from /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/base.apk!classes2.dex] (com.unity3d.player.UnityPlayer$e.run+64)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #63 pc 00000000002b3b10  /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.4832201456133535214+240)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #64 pc 00000000005912e8  /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #65 pc 000000000013f468  /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #66 pc 0000000000136334  /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #67 pc 0000000000144fec  /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #68 pc 00000000004afcec  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #69 pc 00000000004b0e00  /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #70 pc 00000000004f17bc  /apex/com.android.runtime/lib64/libart.so (art::Thread::CreateCallback(void*)+1176)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #71 pc 00000000000d6cb0  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36)
2020-01-16 09:32:09.489 : runtime.cc:630]   native: #72 pc 0000000000074eac  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
2020-01-16 09:32:09.489 : runtime.cc:630]   at com.unity3d.player.UnityPlayer.nativeRender(Native method)
2020-01-16 09:32:09.489 : runtime.cc:630]   at com.unity3d.player.UnityPlayer.c(unavailable:-1)
2020-01-16 09:32:09.489 : runtime.cc:630]   at com.unity3d.player.UnityPlayer$e$2.queueIdle(unavailable:-1)
2020-01-16 09:32:09.489 : runtime.cc:630]   at android.os.MessageQueue.next(MessageQueue.java:405)
2020-01-16 09:32:09.489 : runtime.cc:630]   at android.os.Looper.loop(Looper.java:178)
2020-01-16 09:32:09.489 : runtime.cc:630]   at com.unity3d.player.UnityPlayer$e.run(unavailable:-1)
2020-01-16 09:32:09.489 : runtime.cc:630] 
2020-01-16 09:32:09.491 : runtime.cc:630] Aborting thread:
2020-01-16 09:32:09.492 : runtime.cc:630]   | state=R schedstat=( 11314338067 886937900 16168 ) utm=1032 stm=98 core=4 HZ=100
2020-01-16 09:32:09.492 : runtime.cc:630]   native: #07 pc 0000000000369808  /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+136)
2020-01-16 09:32:09.492 : runtime.cc:630]   native: #14 pc 0000000000210548  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libFirebaseCppApp-6_8_1.so (firebase::App::RegisterLibrary(char const*, char const*)+44)
2020-01-16 09:32:09.492 : runtime.cc:630]   native: #18 pc 0000000002b60434  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libil2cpp.so (???)
2020-01-16 09:32:09.492 : runtime.cc:630]   native: #24 pc 0000000000ca11f0  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)+140)
2020-01-16 09:32:09.492 : runtime.cc:630]   native: #28 pc 0000000000cb8e3c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (MonoBehaviour::DelayedStartCall(Object*, void*)+88)
2020-01-16 09:32:09.492 : runtime.cc:630]   native: #29 pc 000000000092c2bc  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (DelayedCallManager::Update(int)+516)
2020-01-16 09:32:09.502  E/CRASH: backtrace:
2020-01-16 09:32:09.577  E/CRASH:   #00  pc 0000000000000638  [vdso] ()
2020-01-16 09:32:09.577  E/CRASH:   #01  pc 000000000003542c  /apex/com.android.runtime/lib64/bionic/libc.so ()
2020-01-16 09:32:09.577  E/CRASH:   #12  pc 0000000000189004  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libFirebaseCppApp-6_8_1.so (_ZN7_JNIEnv22CallStaticObjectMethodEP7_jclassP10_jmethodIDz+92)
2020-01-16 09:32:09.577  E/CRASH:   #13  pc 0000000000210548  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libFirebaseCppApp-6_8_1.so (_ZN8firebase3App15RegisterLibraryEPKcS2_+44)
2020-01-16 09:32:09.577  E/CRASH:   #23  pc 0000000000ca11f0  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb+140)
2020-01-16 09:32:09.577  E/CRASH:   #24  pc 0000000000caf10c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb+84)
2020-01-16 09:32:09.577  E/CRASH:   #25  pc 0000000000cb9e50  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr+1192)
2020-01-16 09:32:09.577  E/CRASH:   #26  pc 0000000000cb9f40  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr+72)
2020-01-16 09:32:09.577  E/CRASH:   #27  pc 0000000000cb8e3c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv+88)
2020-01-16 09:32:09.577  E/CRASH:   #28  pc 000000000092c2bc  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZN18DelayedCallManager6UpdateEi+516)
2020-01-16 09:32:09.577  E/CRASH:   #29  pc 0000000000abb924  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv+52)
2020-01-16 09:32:09.577  E/CRASH:   #30  pc 0000000000ab2710  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_Z17ExecutePlayerLoopP22NativePlayerLoopSystem+80)
2020-01-16 09:32:09.577  E/CRASH:   #31  pc 0000000000ab276c  /data/app/com.company.myapp-uPz6Jy6NgA-S7dgO1GxocQ==/lib/arm64/libunity.so (_Z17ExecutePlayerLoopP22NativePlayerLoopSystem+172)
2020-01-16 09:32:09.578  E/MessageQueue: IdleHandler threw exception
    java.lang.Error: signal 6 (SIGABRT), code -1 (?), fault addr --------

        at [vdso].(:0)
        at libc.(:0)
        at libart.(:0)
        at libbase.(:0)
        at libart.(:0)
        at libart.(:0)
        at libart.(:0)
        at libart.(:0)
        at libart.(:0)
        at libart.(:0)
        at libart.(:0)
        at libart.(:0)
        at libFirebaseCppApp-6_8_1._ZN7_JNIEnv22CallStaticObjectMethodEP7_jclassP10_jmethodIDz(_ZN7_JNIEnv22CallStaticObjectMethodEP7_jclassP10_jmethodIDz:92)
        at libFirebaseCppApp-6_8_1._ZN8firebase3App15RegisterLibraryEPKcS2_(_ZN8firebase3App15RegisterLibraryEPKcS2_:44)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libil2cpp.(:0)
        at libunity._Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb(_Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb:140)
        at libunity._ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb(_ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb:84)
        at libunity._ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr(_ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr:1192)
        at libunity._ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr(_ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr:72)
        at libunity._ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv(_ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv:88)
        at libunity._ZN18DelayedCallManager6UpdateEi(_ZN18DelayedCallManager6UpdateEi:516)
        at libunity._ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv(_ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv:52)
        at libunity._Z17ExecutePlayerLoopP22NativePlayerLoopSystem(_Z17ExecutePlayerLoopP22NativePlayerLoopSystem:80)
        at libunity._Z17ExecutePlayerLoopP22NativePlayerLoopSystem(_Z17ExecutePlayerLoopP22NativePlayerLoopSystem:172)

My Android manifest looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"  package="com.company.myapp" xmlns:tools="http://schemas.android.com/tools">

    <application android:name="androidx.multidex.MultiDexApplication" 
                 android:icon="@drawable/app_icon" 
                 android:label="@string/app_name" 
                 tools:node="replace"
                 android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

        <meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/smallicon" />
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

        <activity android:label="@string/app_name"
                  android:screenOrientation="portrait"
                  android:launchMode="singleInstance"
                  android:name="com.company.myapp_native.MyUnityPlayerActivity">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="myscheme"/>
            </intent-filter>

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="subdomain.mycompany.com"/>
                <data android:scheme="https" android:host="subdomain.mycompany.com"/>
            </intent-filter>

            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>

        <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />

    </application>
</manifest>

And the crash happens a short time after calling this code

FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith( task =>
            {
                UnityEngine.Debug.Log("NoFirebaseAvailable.Initialize() done "+task.Result);
                if ( task.Result != DependencyStatus.Available )
                {
                    UnityEngine.Debug.LogError( $"Could not resolve all Firebase dependencies: {task.Result}" );
                    return;
                }
            } );

I don't know what I've missed. As far as I can see I've configured everything as per the Firebase set up instructions. The exception seems to be coming from Firebase library but I don't know whats causing it.

Real World
  • 1,593
  • 1
  • 21
  • 46
  • Does this answer your question? [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – Md. Asaduzzaman Jan 16 '20 at 10:01
  • No. I've been programming 20 years. I know what the exception means. I don't know why it's happening. It's in native Firebase code as far as I can tell and given I've set things up as per the Firebase setup guidelines I don't know how to fix it. – Real World Jan 16 '20 at 10:54
  • have you ascertained what value is null? – BugFinder Jan 16 '20 at 12:16
  • Well from the error above, I'm guessing its `FirebaseInstanceI` but I don't know enough about how Firebase works internally to be sure of that. – Real World Jan 16 '20 at 13:15

2 Answers2

1

So there were two problems here that needed to be fixed. Firstly, my .aar with extended UnityActivity was linking an older version of libmessaging_unity_player_activity.jar. I'm not sure that had much impact since the main unity build was including the right one but its worth mentioning. This didn't fix the issue however. Only after reverting the manifest to its "minimal" state I figured out that the tools:node="replace" line in the application tag was causing this odd exception. I don't understand why this caused the crash but removing it fixed it.

Real World
  • 1,593
  • 1
  • 21
  • 46
0

Since you're using the default UnityActivity, I doubt your manifest will cause an issue (it looks like you're using messaging, so see the related documentation).

My guess is that something may have gone wrong with the Play Services Resolver. Make sure that you haven't disabled it, and do a force resolve to make sure everything's in the right place. I did a writeup of the system here if it helps. Screenshot of force resolve under Assets/Play Services Resolver/Android Resolver

I don't see anything in your samples that look like they could break threading in Unity, but it's generally safer to use ContinueWithOnMainThread over ContinueWith. If there's something you haven't shared in the continuation, that could fix a related issue. I made a related writeup on this as well.

Finally, since to my reading you're not doing anything special with the Android Manifest, you might want to just delete it (if you made your own under Assets/Plugins/Android (leave the one alone in Assets/Plugins/Android/Firebase).

I do notice that you say "a short time after calling". It's also possible that you might be accessing a Firebase object without waiting on the result of CheckAndFixDependenciesAsync. This is generally ok if you were going to get DependencyStatus.Available, but if you weren't you'll get a null reference (usually you'll fail if your google play services needs an update or it isn't available on your device). I personally find that if I turn that logic into a Coroutine (or use async/await), it helps me reason about what's waiting on what. But I don't expect that this your issue.

I hope something here helps. And if you think you've run into an actual bug, don't forget to reach out to support. Issues that go up there will often make their way all the way to the engineering team, so it's not as "yelling into the void" as you might think :D.

--Patrick

Patrick Martin
  • 2,993
  • 1
  • 13
  • 11
  • Thanks for your detailed post. Firstly, we're not using the default UnityActivity. It's subclassed but we extend from MessagingUnityPlayerActivity as per the docs. Secondly, I've run the resolver many times. I've reimported the Firebase libraries and ensured we're running the latest. The gradle file looks sensible I've changed all ContinueWith to ContinueWithOnMainThread and the same issue happens I've removed all firebase code apart from the initial call to `CheckAndFixDependenciesAsync` and the crash still happens. – Real World Jan 17 '20 at 14:35
  • Are you doing any Firebase-specific logic in your Activity or is it all C# side? Are you using the google services plugin in gradle or letting the Unity plugin manage that bit of logic? Are there any useful bits in LogCat? – Patrick Martin Jan 17 '20 at 17:03
  • I've reverted to Firebase 6.1.1 which we have had working in a project before and had more progress. It no longer hard crashes. Instead, I get these errors which maybe helpful? – Real World Jan 20 '20 at 11:10
  • `firebase: Firebase App initializing app com.company.myapp (default 1). Unity: Firebase App initializing app com.company.myapp (default 1). System.err: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.company.myapp. Make sure to call FirebaseApp.initializeApp(Context) first. System.err: at com.google.firebase.FirebaseApp.getInstance firebase: new_app Unity: new_app firebase: Failed to initialize the default Firebase App.` – Real World Jan 20 '20 at 11:10