How To Enable Camera in Android Emulator

By default when you create an Android Virtual Devices (AVD) in Android, the Camera is disabled. So if your application uses Camera API, it might not work properly in Android Emulator. Also SDCard must be defined in emulator in order to use Camera.

To enable Camera in your Android Emulator, just add following highlighted code in your AVD’s config.ini file. You can find the config.ini file under your user directory/.android folder.

File: ~/.android/config.ini

hw.lcd.density=160 skin.name=HVGA skin.path=platforms\android-9\skins\HVGA hw.cpu.arch=arm abi.type=armeabi vm.heapSize=24 image.sysdir.1=platforms\android-9\images\ hw.camera=yes sdcard.size=64M ... ...

In case you don’t find the config.ini file or want to enable Camera support through Android SDK and AVD Manager, follow below simple steps.
Open Android SDK and AVD Manager:

Step 1: Add SD Card in AVD

In the SD Card setting, set the value for Size. To enable camera, the SD Card must be enabled in Emulator.

Step 2: Add Camera Support in Hardware under AVD

Now under Hardware section, click New button to add Camera hardware. It will open following Dialog box. Select Camera support from the Property dropdown and click Ok.

Step 3: Enable Camera Support in Hardware

The new hardware: Camera support is visible under Hardware section. Set its value to yes and save changes by pressing Edit AVD.

And that’s all. Just save the changes and launch the emulator. You’ll be able to start Camera application and take snaps (Default android pic) through it.

View Comments

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

4 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

4 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

4 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

4 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

4 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

5 years ago