android模拟器无法使用camera拍照

1在模拟器里,无法启动camera;

模拟器默认是disable camera的,需要enable,在AVD的设置界面添加camera support yes这个属性;

2成功启动camera之后,真正拍照的时候,提示“your sdcard is full",我明明有一个100M的sdcard啊!

模拟器的internal storage可能所剩无几的,所以需要给模拟器配置一个sdcard,在AVD的配置界面,给sdcard分配空间,比如100MB,注意这个大小的设置需要在新建AVD的时候设置;

3I allocated 50MB to the SD card on the emulator and put 2 files in the SD card folder. Now I deleted the files and want to put a new file, but I get a message of no space left. Is there something like a recycle bin on the emulator? How do I delete the files permanently, so I'll be able to use the space they occupied? Thanks.

  its happen that emulator memory cleanup is too slow. when we delete something, it doesnt reflect at the same time. so, its better to increase your sdcard size at the time of creating 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’sconfig.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.

在Android中,默认创建的AVD不能使用照相机.如果你的程序用到了相机API,在模拟器中就不能正常工作.为了使用相机,SD卡必须在模拟器中定义.

在模拟器中打开相机,只需要在AVD’sconfig.inifile中计入如下高亮代码.config.ini文件在 user directory/.android 文件夹下.

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
...
...

如果你找不到config.ini文件,或者你想通过 Android SDK and AVD Manager相机功能,参照下面的步骤.


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.

打开Android SDK 和 AVD Manager:

步骤1:在AVD添加SD卡

在SD卡设置中,给Size指定一个值.要打开相机,模拟器中SD卡必须可用.


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.

步骤2:在AVD下,添加相机硬件支持

现在,在Hardware 节下, 单机 New 添加相机硬件.在打开的对话框中,选择 Camera support ,然后点击 Ok.


android模拟器无法使用camera拍照_第1张图片

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.

步骤3:在硬件中启用相机支持

新硬件: 相机支持在硬件节下可以看见. 设置值为 yes ,然后点击 Edit AVD保持修改.


android模拟器无法使用camera拍照_第2张图片

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.

这就是全部.现在保持修改,运行模拟器.你现在就可以启动相机程序拍照(默认的android 图片).

你可能感兴趣的:(android模拟器无法使用camera拍照)