title: Tango app suddenly breaks with JNI DETECTED ERROR IN APPLICATION
body: <p>I'm developing an app using Google Tango. For a while everything worked fine, but yesterday after refactoring some variables and reverting some changes it suddenly broke. When starting the app I get the following error log:</p>
  
  <pre><code>A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String android.os.IBinder.getInterfaceDescriptor()' on a null object reference
  A/art: art/runtime/java_vm_ext.cc:410]   at void com.google.atap.tangoservice.TangoPointCloudData.readFromParcel(android.os.Parcel) (TangoPointCloudData.java:154)
  A/art: art/runtime/java_vm_ext.cc:410]   at void com.google.atap.tangoservice.TangoPointCloudData.&lt;init&gt;(android.os.Parcel) (TangoPointCloudData.java:109)
  A/art: art/runtime/java_vm_ext.cc:410] 
  A/art: art/runtime/java_vm_ext.cc:410]     in call to CallVoidMethodV
  A/art: art/runtime/java_vm_ext.cc:410] "Binder_2" prio=5 tid=9 Runnable
  A/art: art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x12cfa0a0 self=0x5594118c60
  A/art: art/runtime/java_vm_ext.cc:410]   | sysTid=26922 nice=0 cgrp=default sched=0/0 handle=0x7fa30ed450
  A/art: art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 23739007 23622981 186 ) utm=0 stm=2 core=3 HZ=100
  A/art: art/runtime/java_vm_ext.cc:410]   | stack=0x7fa2ff1000-0x7fa2ff3000 stackSize=1013KB
  A/art: art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
  A/art: art/runtime/java_vm_ext.cc:410]   (no managed stack frames)
  A/art: art/runtime/java_vm_ext.cc:410] 
  A/art: art/runtime/runtime.cc:366] Runtime aborting...
  A/art: art/runtime/runtime.cc:366] Aborting thread:
  A/art: art/runtime/runtime.cc:366] "Binder_2" prio=5 tid=9 Native
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x12cfa0a0 self=0x5594118c60
  A/art: art/runtime/runtime.cc:366]   | sysTid=26922 nice=0 cgrp=default sched=0/0 handle=0x7fa30ed450
  A/art: art/runtime/runtime.cc:366]   | state=R schedstat=( 42129216 29262460 216 ) utm=2 stm=2 core=5 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa2ff1000-0x7fa2ff3000 stackSize=1013KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
  A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
  A/art: art/runtime/runtime.cc:366] Pending exception java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String android.os.IBinder.getInterfaceDescriptor()' on a null object reference
  A/art: art/runtime/runtime.cc:366]   at void com.google.atap.tangoservice.TangoPointCloudData.readFromParcel(android.os.Parcel) (TangoPointCloudData.java:154)
  A/art: art/runtime/runtime.cc:366]   at void com.google.atap.tangoservice.TangoPointCloudData.&lt;init&gt;(android.os.Parcel) (TangoPointCloudData.java:109)
  A/art: art/runtime/runtime.cc:366] Dumping all threads without appropriate locks held: thread list lock mutator lock
  A/art: art/runtime/runtime.cc:366] All threads:
  A/art: art/runtime/runtime.cc:366] DALVIK THREADS (17):
  A/art: art/runtime/runtime.cc:366] "Binder_2" prio=5 tid=9 Runnable
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x12cfa0a0 self=0x5594118c60
  A/art: art/runtime/runtime.cc:366]   | sysTid=26922 nice=0 cgrp=default sched=0/0 handle=0x7fa30ed450
  A/art: art/runtime/runtime.cc:366]   | state=R schedstat=( 51036091 29262460 221 ) utm=3 stm=2 core=5 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa2ff1000-0x7fa2ff3000 stackSize=1013KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes= "abort lock" "mutator lock"(shared held)
  A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "main" prio=5 tid=1 Native
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x73ef86e8 self=0x5593e6de30
  A/art: art/runtime/runtime.cc:366]   | sysTid=26910 nice=0 cgrp=default sched=0/0 handle=0x7fa7c1efc8
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 957520220 146169897 1107 ) utm=74 stm=21 core=2 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fef65d000-0x7fef65f000 stackSize=8MB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xdc/0x1e4
  A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0xf8/0x174
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   at android.os.MessageQueue.nativePollOnce(Native method)
  A/art: art/runtime/runtime.cc:366]   at android.os.MessageQueue.next(MessageQueue.java:323)
  A/art: art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:135)
  A/art: art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:5418)
  A/art: art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
  A/art: art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  A/art: art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "Signal Catcher" prio=5 tid=2 WaitingInMainSignalCatcherLoop
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12cec0a0 self=0x55941009b0
  A/art: art/runtime/runtime.cc:366]   | sysTid=26915 nice=0 cgrp=default sched=0/0 handle=0x7fa3a2d450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 653333 0 1 ) utm=0 stm=0 core=4 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa3931000-0x7fa3933000 stackSize=1013KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: do_sigtimedwait+0xd8/0x1ac
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_rt_sigtimedwait+0xac/0xec
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "JDWP" prio=5 tid=3 WaitingInMainDebuggerLoop
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12cef0a0 self=0x55940f04e0
  A/art: art/runtime/runtime.cc:366]   | sysTid=26916 nice=0 cgrp=default sched=0/0 handle=0x7fa3927450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 15460212 647917 28 ) utm=0 stm=1 core=2 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa382b000-0x7fa382d000 stackSize=1013KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: poll_schedule_timeout+0x54/0xb8
  A/art: art/runtime/runtime.cc:366]   kernel: do_select+0x414/0x468
  A/art: art/runtime/runtime.cc:366]   kernel: core_sys_select+0x1e0/0x2e0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_pselect6+0x15c/0x1f0
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "ReferenceQueueDaemon" prio=5 tid=4 Waiting
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12ce8c40 self=0x55940f30f0
  A/art: art/runtime/runtime.cc:366]   | sysTid=26917 nice=0 cgrp=default sched=0/0 handle=0x7fa381f450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 607968 21093 12 ) utm=0 stm=0 core=4 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa371d000-0x7fa371f000 stackSize=1037KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xdc/0x1e4
  A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0xf8/0x174
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   at java.lang.Object.wait!(Native method)
  A/art: art/runtime/runtime.cc:366]   - waiting on &lt;0x0f1a6280&gt; (a java.lang.Class&lt;java.lang.ref.ReferenceQueue&gt;)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:147)
  A/art: art/runtime/runtime.cc:366]   - locked &lt;0x0f1a6280&gt; (a java.lang.Class&lt;java.lang.ref.ReferenceQueue&gt;)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "FinalizerDaemon" prio=5 tid=5 Waiting
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12ce8ca0 self=0x55940fb030
  A/art: art/runtime/runtime.cc:366]   | sysTid=26918 nice=0 cgrp=default sched=0/0 handle=0x7fa3713450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 1231977 91667 11 ) utm=0 stm=0 core=5 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa3611000-0x7fa3613000 stackSize=1037KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xdc/0x1e4
  A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0xf8/0x174
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   at java.lang.Object.wait!(Native method)
  A/art: art/runtime/runtime.cc:366]   - waiting on &lt;0x073f20b9&gt; (a java.lang.ref.ReferenceQueue)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Object.wait(Object.java:423)
  A/art: art/runtime/runtime.cc:366]   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:101)
  A/art: art/runtime/runtime.cc:366]   - locked &lt;0x073f20b9&gt; (a java.lang.ref.ReferenceQueue)
  A/art: art/runtime/runtime.cc:366]   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:72)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "FinalizerWatchdogDaemon" prio=5 tid=6 Sleeping
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12ce8d00 self=0x5593f9e6a0
  A/art: art/runtime/runtime.cc:366]   | sysTid=26919 nice=0 cgrp=default sched=0/0 handle=0x7fa3607450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 416302 0 6 ) utm=0 stm=0 core=0 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa3505000-0x7fa3507000 stackSize=1037KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xdc/0x1e4
  A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0xf8/0x174
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.sleep!(Native method)
  A/art: art/runtime/runtime.cc:366]   - sleeping on &lt;0x09ef7cfe&gt; (a java.lang.Object)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.sleep(Thread.java:1031)
  A/art: art/runtime/runtime.cc:366]   - locked &lt;0x09ef7cfe&gt; (a java.lang.Object)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.sleep(Thread.java:985)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor(Daemons.java:273)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:284)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:232)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "HeapTaskDaemon" prio=5 tid=7 Native
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12ce8d60 self=0x5593e8d5f0
  A/art: art/runtime/runtime.cc:366]   | sysTid=26920 nice=0 cgrp=default sched=0/0 handle=0x7fa34fb450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 25782812 1505781 106 ) utm=2 stm=0 core=2 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa33f9000-0x7fa33fb000 stackSize=1037KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xdc/0x1e4
  A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0xf8/0x174
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/art: art/runtime/runtime.cc:366]   at dalvik.system.VMRuntime.runHeapTasks(Native method)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$HeapTaskDaemon.run(Daemons.java:355)
  A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:818)
  A/art: art/runtime/runtime.cc:366] 
  A/art: art/runtime/runtime.cc:366] "Binder_1" prio=5 tid=8 Native
  A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12cf70a0 self=0x5593faa340
  A/art: art/runtime/runtime.cc:366]   | sysTid=26921 nice=0 cgrp=default sched=0/0 handle=0x7fa31f3450
  A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 19983811 29755159 199 ) utm=1 stm=0 core=3 HZ=100
  A/art: art/runtime/runtime.cc:366]   | stack=0x7fa30f7000-0x7fa30f9000 stackSize=1013KB
  A/art: art/runtime/runtime.cc:366]   | held mutexes=
  A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xd4/0x12c
  A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xdc/0x1e4
  A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xc8/0x8d0
  A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0xf8/0x174
  A/art: art/runtime/runtime.cc:366]   kernel: cpu_switch_to+0x48/0x4c
  A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 26922 (Binder_2)
  </code></pre>
  
  <p>I narrowed down the cause to this line:</p>
  
  <pre><code>mTango.connectListener(framePairs, new Tango.OnTangoUpdateListener() {...});
  </code></pre>
  
  <p>But since the error doesn't mention any part of my code I don't know where to look further.</p>
  
  <p>My findings so far after working on the problem:</p>
  
  <ul>
  <li>It doesn't matter if the Listener contains code or not.</li>
  <li>The error only occurs just after the camera gets a picture. So as long as the device lies on the table so that the camera is blocked the app technically runs fine.</li>
  <li>Even though the app used to work before, even earlier commits are now broken.</li>
  <li>The basic examples from Google still work fine.</li>
  <li>Using a different version of Tango or Android doesn't change anything.</li>
  <li>Cleaning gradle or doing a clean install changes nothing.</li>
  <li>I found in another thread on Stackoverflow that the cause might lie in the library's code, but since it used to work before I don't see how this could be it.</li>
  </ul>
  
  <p>Does anyone has an idea how to fix this problem?</p>