Log in or register to post comments

QCAR causes ANR

November 8, 2011 - 9:46am #1

I'm working on an application that uses QCAR however it doesn't use it quite like the samples that come with the sdk. The ar view is only one part of the app and it shows it in an activity that can potentially be created and destroyed several times. However from time to time the app will freeze up when showing the ar view and become non-responsive and then will display the app not responding dialog. After I force close the app and reopen and go to the activity that uses QCAR I get the following exception:

java.lang.RuntimeException: Fail to connect to camera service

Also the native android calendar app doesn't even work and shows a dialog stating it can't connect to the camera. Anyone have any idea why this might be happening? Also, I noticed this happens most frequently on my Nexus S, if that helps.


Re: QCAR causes ANR

November 14, 2011 - 6:40pm #6

Girish, do you have a simple sample that experiences the ANR problem? For instance can you add your dataset to the ImageTargets sample and see a problem? Or do you have a more complex application with multiple activities?

Also, if you get a chance try renaming all your targets to be 10 characters or less. Does that help at all? We're seeing a rare bug with long trackable names...


- Kim

Re: QCAR causes ANR

November 13, 2011 - 10:05pm #5


Yes, I have also faced a similar issue (ANR) and camera freezing.

This scenario happens when I have more than 20 trackable images in the resources.dat. If I reduce the number of images to around 4 - then the same code works fine. But when I have more than 20 (to be precise I had 23 images), then the camera is not able to run properly. The camera starts and freezes soon. When I try to click the back button - I get the ANR pop-up.

Also in this case if I try to stop the application and re-start I get an error that the camers is being used. Some times I had to restart the device to overcome this issue. But the camera freeze was not improved.

I feel the reason is as follows:
The camera is running in the main UI thread context.
The renderer is set to the main view
The renderer is rendered by the JNI code - drawing the camera video background.
During rendering it checkes if there are any active trackables
In case of a bigger database (more number of trackables), each camera frame should be matched with all the trackables - and this is taking more time to complete.

So the ANR and the freezing of camera view is happening.

Does this make sense??


Re: QCAR causes ANR

November 10, 2011 - 11:04am #4

Hey Kim,
I sent you a message with the link for the project code, thanks for you help.

Re: QCAR causes ANR

November 8, 2011 - 7:17pm #3

Thanks for the reply, the phone I most consistently get this issue on is the Nexus S running 2.3.3. After the ANR dialog shows up and I close the app I cannot open the phone's camera app, it says cannot connect to the camera. Also afterwards when I try to start the ar view in my app I get that error I posted in the previous post. I will ask if I can share the project with you and let you know.

Re: QCAR causes ANR

November 8, 2011 - 6:57pm #2

I haven't seen an ANR with QCAR in a long time... Are you using the latest version (1.0.6)? Also, what Android OS version is on your device?

It sounds like the camera resource isn't getting properly released, which is possible if you're having to force close the app. When that happens try opening the device's camera app, does that work?

Could you possibly share the project that is showing this behavior? You can send to


- Kim

Log in or register to post comments