Any help would be really appreciated.
The Crash
My Unity app uses Firebase Firestore listeners to receive data. In the Unity editor everything works very well and I never get an error. I built to my Android device (Pixel 2), but there it crashes about a second after startup.
I looked at Android Logcat and noticed that the last thing it did was receive a callback from Firestore:
2021/02/10 17:45:17.898 26111 26146 Info Unity Received Public Projects Query Callback. No pending writes, so we can update the Projects. Documents: 22021/02/10 17:45:17.898 26111 26146 Info Unity ArchViewer.<>c:<ListenToPublicProjects>b__67_0(QuerySnapshot)2021/02/10 17:45:17.898 26111 26146 Info Unity System.Action`1:Invoke(T)2021/02/10 17:45:17.898 26111 26146 Info Unity Firebase.Firestore.<Listen>c__AnonStorey1:<>m__0()2021/02/10 17:45:17.898 26111 26146 Info Unity System.Func`1:Invoke()2021/02/10 17:45:17.898 26111 26146 Info Unity System.Action`3:Invoke(T1, T2, T3)2021/02/10 17:45:17.898 26111 26146 Info Unity Firebase.Firestore.Query:QuerySnapshotsHandler(Int32, IntPtr, FirestoreError, String)2021/02/10 17:45:17.898 26111 26146 Info Unity Firebase.AppUtilPINVOKE:PollCallbacks()2021/02/10 17:45:17.898 26111 26146 Info Unity Firebase.AppUtil:PollCallbacks()2021/02/10 17:45:17.898 26111 26146 Info Unity Firebase.Platform.FirebaseHandler:Update()2021/02/10 17:45:17.898 26111 26146 Info Unity
After that the fatal error(s) happens:
2021/02/10 17:45:17.908 26111 26146 Fatal igns.ArchViewe java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: mid == null2021/02/10 17:45:17.908 26111 26146 Fatal igns.ArchViewe java_vm_ext.cc:577] in call to CallObjectMethodV2021/02/10 17:45:17.908 26111 26146 Fatal igns.ArchViewe java_vm_ext.cc:577] from boolean com.unity3d.player.UnityPlayer.nativeRender()2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] Runtime aborting...2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] Dumping all threads without mutator lock held2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] All threads:2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] DALVIK THREADS (46):2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] "Jit thread pool worker thread 0" prio=5 tid=7 Runnable2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] | group="" sCount=0 dsCount=0 flags=0 obj=0x132c0228 self=0x7937c4f0102021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] | sysTid=26122 nice=0 cgrp=default sched=0/0 handle=0x77b45eed002021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] | state=R schedstat=( 67570784 10588910 215 ) utm=4 stm=1 core=6 HZ=1002021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] | stack=0x77b44f0000-0x77b44f2000 stackSize=1023KB2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] | held mutexes= "mutator lock"(shared held)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #00 pc 00000000004a53f4 /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #01 pc 00000000005b42b4 /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+372)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #02 pc 00000000005d1854 /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+924)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #03 pc 00000000005b5220 /apex/com.android.art/lib64/libart.so (art::Thread::RunCheckpointFunction()+176)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #04 pc 0000000000346168 /apex/com.android.art/lib64/libart.so (art::jit::JitCompileTask::Run(art::Thread*)+1312)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #05 pc 00000000005d2814 /apex/com.android.art/lib64/libart.so (art::ThreadPoolWorker::Run()+108)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #06 pc 00000000005d22f8 /apex/com.android.art/lib64/libart.so (art::ThreadPoolWorker::Callback(void*)+192)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #07 pc 00000000000b0758 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] native: #08 pc 0000000000050150 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)2021/02/10 17:45:18.122 26111 26146 Fatal igns.ArchViewe runtime.cc:655] (no managed stack frames)
And that goes on for another 2700 lines... Don't even know which section to look at.
The code that sets up the Firestore listener (but don't think the problem is in the code as it works fine in the Unity editor):
public static ListenerRegistration ListenToPublicProjects(Timestamp LastModified) { Query queryRef = database.Collection(ProjectsCollection).WhereEqualTo(ProjectTypeField, 1) .WhereGreaterThan(LastModifiedField, LastModified); ListenerRegistration listener = queryRef.Listen(snapshot => { if (snapshot.Metadata.HasPendingWrites) { Debug.Log("Received Public Projects Query Callback. Still waiting for pending writes before we can update the Projects..."); return; } else Debug.Log("Received Public Projects Query Callback. No pending writes, so we can update the Projects. Documents: " + snapshot.Count); if (snapshot.Count == 0) { Debug.Log("Public Projects Query is empty"); return; } foreach (DocumentChange change in snapshot.GetChanges()) { DocumentSnapshot document = change.Document; ArchProjectData projectData = ArchProjectData.FromDictionary(document.ToDictionary()); ArchProject project = AssemblyManager.CreateProject(projectData); if (change.ChangeType == DocumentChange.Type.Added) { Debug.Log(String.Format("New public project: {0}", change.Document.Id)); ReferenceManager.AddProject(project, ProjectList.PublicProjects); } else if (change.ChangeType == DocumentChange.Type.Modified) { Debug.Log(String.Format("Modified public project: {0}", change.Document.Id)); ReferenceManager.UpdateProject(project, ProjectList.PublicProjects); } else if (change.ChangeType == DocumentChange.Type.Removed) { Debug.Log(String.Format("Removed public project: {0}", change.Document.Id)); ReferenceManager.RemoveProject(project, ProjectList.PublicProjects); } } OnPublicProjectsReceived?.Invoke(); }); return listener; }
Background info
Unity version: 2020.2.3
Firebase SDK version: 7.0.2
Android version: 11
Because of this crash I decided to completely rebuild my project from scratch to make sure nothing else was interfering, but it still happened. How would I go about solving this?