Android SDK Camera API Demo Crashes

android, android-emulator, camera

Solution

Make sure you have set permissions in the AndroidManifest.xml file for using the camera. Place this line above the application tag.

<uses-permission android:name="android.permission.CAMERA" />

Problem

The Android SDK has an API demo for using the preview of the camera. However, this gives me a runtime exception in the emulator. I'm running with Eclipse on a Mac with 10.6 Here's the link where I grabbed the code: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html

Original source