[android] Using Camera in the Android emulator

I wish to simulate camera in the android emulator using the webcam. Basically I need to only take photos with the camera in the emulator (live preview is not needed i.e if it makes it any easier)

I followed the tutorial here which is the only one I could find that was close to my requirements

But many of the libraries used in that tutorial(like android.hardware.CameraDevice) are not available in present sdk and are replaced by new libraries(like android.hardware.camera).

Any help on how to do this in the present sdk(2.1 or 2.2) would be much appreciated.

This question is related to android camera emulation simulation

The answer is


The newest camera2 apis work fine w/ an emulator that has camera support enabled.

Example for using the newer API:

https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/java/com/example/android/camera2basic/AutoFitTextureView.java


In your AVD advanced settings, you should be able to set front and back cameras to Webcam() or Emulated.

enter image description here


Update of @param's answer.

ICS emulator supports camera.

I found Simple Android Photo Capture, which supports webcam in android emulator.


Just in case you just need to show a picture in response to a camera request, there is image-to-camera.

Just download, build, install, copy an image of your choice to the device, and you can select it via the app, which is an alternative to the built-in camera.


There is an updated version of Tom Gibara's tutorial. You can change the Webcam Broadcaster to work with JMyron instead of the old JMF.

The new emulator (sdk r15) manage webcams ; but it has some problems with integrated webcams (at least with mine's ^^)


Does not seem like it, but android recognises a webcam as a device. Every time I run the emulator my webcam's active light comes on.


Some elaboration, in the hope of clarifying what has already been said:

As stated above, Webcams are supported natively in the current SDK, but only on recent android versions (4.0 and higher)

Webcam detection is automatic where present. In 4.0.3, the camera defaults to the front-facing camera so a lot of applications (especially pre-2.3 applications, which can only fetch the default camera, i.e. the back-facing one) will still show you the old checkerbox-with-moving-square stand-in instead.

I think some more info is available in the following post: Camera on Android Eclipse emulator:

Or at least, that's the most information I've been able to find--aside from the brief, uninformative statements in the release notes for the SDK tools.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to camera

Ionic 2: Cordova is not available. Make sure to include cordova.js or run in a device/simulator (running in emulator) NSCameraUsageDescription in iOS 10.0 runtime crash? How get permission for camera in android.(Specifically Marshmallow) Get file path of image on Android Taking pictures with camera on Android programmatically Why does an image captured using camera intent gets rotated on some devices on Android? Access camera from a browser Best way to access web camera in Java Setting Camera Parameters in OpenCV/Python HTML5: camera access

Examples related to emulation

Waiting for Target Device to Come Online Android emulator not able to access the internet Intel X86 emulator accelerator (HAXM installer) VT/NX not enabled Google Play Services Missing in Emulator (Android 4.4.2) Is there a real solution to debug cordova apps Genymotion Android emulator - adb access? How to get the sign, mantissa and exponent of a floating point number Simulate user input in bash script Enabling WiFi on Android Emulator How do I rotate the Android emulator display?

Examples related to simulation

How to set fake GPS location on IOS real device VHDL - How should I create a clock in a testbench? Recursion in Python? RuntimeError: maximum recursion depth exceeded while calling a Python object Using Camera in the Android emulator What's the difference between emulation and simulation? Simulator or Emulator? What is the difference? source of historical stock data