camera force close in app when take photo


  1. alex belex

    alex belex Member

    i have an apk app which can take photo and take video with a button.

    I have first device running the app and I have 2 button, take photo and take video.
    When I click take video in this app and it works well but when i click take picture from the button, the app always "force closes".
    this is my error logcat


    [HIGH]
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): FATAL EXCEPTION: main 11-19 14:43:27.085: ERROR/AndroidRuntime(6903): java.lang.NullPointerException
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at com.android.camera.Camera.initializeFirstTime(Came ra.java:328)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at com.android.camera.Camera.access$1100(Camera.java: 95)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at com.android.camera.Camera$MainHandler.handleMessag e(Camera.java:282)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at android.os.Handler.dispatchMessage(Handler.java:99 )
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at android.os.Looper.loop(Looper.java:130) 11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at android.app.ActivityThread.main(ActivityThread.jav a:3683)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at java.lang.reflect.Method.invokeNative(Native Method)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at java.lang.reflect.Method.invoke(Method.java:507)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:839)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:597)
    11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at dalvik.system.NativeStart.main(Native Method)
    11-19 14:43:27.093: WARN/ActivityManager(1308): Force finishing activity com.android.camera/.Camera
    11-19 14:43:27.109: WARN/ActivityManager(1308): Force finishing activity makemachine.android.examples/.PhotoCaptureExample[/HIGH]

    When i try to run it on other device, this app works perfectly.
    How to fix this, So that i can run and take photos in my first device?
    BR.

    Alex

    Advertisement
  2. jonbonazza

    jonbonazza Well-Known Member

    What is on line 328 or your Camera.java file?
  3. alex belex

    alex belex Member

    i tried but i cant find camera.java in my device. how to find and check camera.java and open my camera.java?

    EDIT: when i edit in button take photo from MediaStore.ACTION_IMAGE_CAPTURE to ACTION_VIDEO_CAPTURE . the button works but this is a video, maybe a bug inside ACTION_IMAGE_CAPTURE? i want to take photo image but always force close.
  4. jonbonazza

    jonbonazza Well-Known Member

    Derp... Sorry that was a brain fart on my part. The Camera.java file is part of the Android SDK. Ignore my previous post. XD

    At any rate, can you post the rest of the log cat (even copying/pasting it in a file and attaching the file works if it's too long)? What you posted isn't the entire error message and doesn't show what I need to see to help you.
  5. alex belex

    alex belex Member

    oh ok. sory im newbie in android. so i dont know where location camera.java.
    [​IMG]


    I've been trying for 1 month to solve this case, but I still cannot find a solution. maybe something wrong with this hardware device? the device can't auto rotate too.

    my logcat before is a log when camera force close.

    and this is attach my full logcat.

    and capture


    [​IMG]

    Attached Files:

  6. jonbonazza

    jonbonazza Well-Known Member

    Interesting.... It seems that what you posted was, indeed, the entire error message... That's odd, as it doesn't make any mention of YOUR application. This would imply that it is a problem with either (a) the SDK code, or (b) the hardware drivers. The SDK code does work, so that only leaves scenario (b). Unfortunately, I don't really know what to tell you going forward.

    What device is it?
  7. alex belex

    alex belex Member


    Speedata MT35A from china.

    android 2.3.7

    but the camera in this device is work normally. when i try without my application, camera can take picture successfully

Share This Page