Log in or register to post comments

Crash when activating Flash

June 9, 2011 - 12:37pm #1

I get some crash report form my users, here is the callstack I get :

java.lang.NullPointerException
	at com.qualcomm.QCAR.CameraPreview.setFlashTorchMode(CameraPreview.java:871)
	at com.ar.arviewmodule.ImageTargets.toggleFlashNative(Native Method)
	at com.ar.arviewmodule.ImageTargets.toggleFlash(ImageTargets.java:807)
	at com.ar.arviewmodule.ImageTargets.onOptionsItemSelected(ImageTargets.java:757)
	at android.app.Activity.onMenuItemSelected(Activity.java:2195)
	at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:752)
	at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
	at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
	at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
	at android.view.View$PerformClick.run(View.java:8890)
	at android.os.Handler.handleCallback(Handler.java:587)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:123)
	at android.app.ActivityThread.main(ActivityThread.java:4627)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:521)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
	at dalvik.system.NativeStart.main(Native Method)

It look like it's crashing in some QCar files. Here is my implementation of toggleFlashNative :

JNIEXPORT jboolean JNICALL
/** Toggle the flash */
Java_com_ar_arviewmodule_ImageTargets_toggleFlashNative(JNIEnv *, jobject, jboolean flash)
{
  return QCAR::CameraDevice::getInstance().setFlashTorchMode((flash==JNI_TRUE)) ? JNI_TRUE : JNI_FALSE;
}

Maybe you have an idea of what causes the crash?

Re: Crash when activating Flash

June 9, 2011 - 3:41pm #3

Ok I'll check that out. Thank you.

Re: Crash when activating Flash

June 9, 2011 - 2:58pm #2

Hello,

It looks like you are setting the camera flash mode when the camera is not initalized, be sure that you are not calling this method before you initialize the camera or after you de-initialize the camera.

-Peter

Log in or register to post comments