Log in or register to post comments

Vuforia Unity Android app crashes (ANR) after switching app back to foreground

June 12, 2014 - 10:25am #1
Hello Support-Team,
We have an intermittent problem that quite often crashes/freezes our Unity app after switching to a different app, and then switching back to the Unity app. It doesn't seem to be reproducible when or under which conditions this happens - sometimes after the first background/foreground switch, sometimes after minutes of doing nothing, sometimes after switching a lot betwwen background processes.
After switching back to the Unity app, all that's visible is a black screen, followed sometimes by the ANR dialog.
What we do in our app:
- We're using the QCARBehaviour (ARCamera prefab), and the ImageTargetBehaviour (type Predefined).
- Our app switches between AR and non-AR modes by enabling/disabling the QCARBehaviour and ImageTargetBehaviour component, keeping the MainCamera always active. The only other Camera in the scene is an NGUI Camera.
The logs *seem* to suggest this might be related to the QCAR plugin, but I'm not fluent enough in Android development to be certain. See the attached output from adb logcat -v time (I filtered out truly irrelevant stuff, such as Battery messages etc.), and /data/anr/traces.txt
logcat says: 06-12 16:37:11.170 I/InputDispatcher( 3979): Application is not responding. It has been 20002.7ms since event, 20001.1ms since wait started. Reason: Waiting because the touched window has not finished processing the input events that were previously delivered to it.
and: 06-12 16:37:22.430 D/CrashAnrDetector( 3979): Activity: com.nmy.airbusds/com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity
traces.txt says "waiting on <0x4226c398> (a java.lang.VMThread) held by tid=25 (FMODStreamBlocker)" at com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity.onWindowFocusChanged(QCARPlayerNativeActivity.java:105)
 Could you please help us determine what is the cause of these crashes? I didn't find a lot of useful information on the web about this. The only thing I found that might be related suggested a problem concerning activity and configuration changes: http://forum.unity3d.com/threads/android-apps-crashing-on-resume.127794/
Program and file versions:
Unity: 4.3.4f1
Vuforia: 2.8.9
Device: Samsung Galaxy Note 10.2 2014 Edition, Android 4.3
Build Settings: for Android 4.0.3 (API 15), built on Windows using Unity Editor. Graphics Level OpenGL ES 3.0, Api Compatibility .NET 2.0, stripping disabled
Android SDK: Tools 22.6.2, platform-tools 19.0.1
Plain text icon logcat.txt52.96 KB
Plain text icon traces.txt304.83 KB

Vuforia Unity Android app crashes (ANR) after switching app back

June 19, 2014 - 2:29am #3

UPDATE: Vuforia 3.0.5 ha been released and is publicly available for download here:



You may want to try and upgrade to this latest version and verify if the issue reported below is resolved.

Vuforia Unity Android app crashes (ANR) after switching app back

June 16, 2014 - 2:21am #2


looking at the traces.txt : 

at com.unity3d.player.UnityPlayer.g((null):-1)
  at com.unity3d.player.UnityPlayer.windowFocusChanged((null):-1)
  at com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity.onWindowFocusChanged(QCARPlayerNativeActivity.java:105)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:2939)
  at android.view.View.dispatchWindowFocusChanged(View.java:8039)

the chain is triggered by android.view.View.dispatchWindowFocusChanged and goes on with the UnityPlayer.windowFocusChanged... but it is hard to say whether Vuforia (i.e. QCARPlayerNativeActivity) plays any role in causing this crash.

Since this is about switching between Apps back and forth, it would be useul to have a simple repro-case based on one of the Vuforia samples for instance, or on a simple scene setup with a minimal Vuforia setup and a sequence of steps to reproduce it.

The other thing that might be related to this is the issue described in this thread:


In particular, check the code snippet that I posted in one of the comments, which starts with 

void OnApplicationPause( 

as there was an issue with Vuforia 2.8 that was causing QCAR being restarted during an onResume event, even if QCARBehaviour was not enabled... perhaps this could be related. Also, note that this issue has been fixed in the upcoming release of Vuforia (3.0) which is expected to be released soon.




Log in or register to post comments