Showing posts with label Emulator. Show all posts
Showing posts with label Emulator. Show all posts

Saturday, January 14, 2023

[Solved] The stock Camera app in Android Emulator could not take any photo - error msg: Insert an SD card before using the camera. What's wrong with the AVD?

I created an AVD (Android Virtual Device) based on API Level 28 (Android 9.0). But when I tried to take a photo, the stock Camera app said "Insert an SD card before using the camera". Check the screentshot as below. So, I failed to take any photo at all.



But in fact, in the AVD Advanced Settings, already there is a 'Studio-managed SD card' set up for this AVD.


The Android Emulator I used -


The System Image I used for this AVD -



Now I wonder,

Q1: Why couldn't the built-in camera app of this AVD take any picture? Why is an SD card necessary for taking a photo? Why couldn't the Studio-managed SD card be recognized?

Q2: Do you all also have this issue in the AVD created on your PC?

Q3: Should this be because there is a bug in this API Level 28 System Image, or is the version of Android Emulator defective?


Any ideas? Thank you all for your attention. Have a good weekend.



Updated on Jan 16, 2023. -----------------------------------------------------------------

After Google search, research, and several comparison experiments, I found out that this problem is because this 64-bit System Image is likely to have a bug about camera feature. Use the x86 System Image for your Android 9.0 AVD instead even if your Windows host is 64-bit.

Share it for your reference.




Saturday, January 8, 2022

How to create an Android Virtual Device (AVD) with ease?


As we know, an Android Virtual Device (AVD) is a configuration that defines the characteristics of an Android phone, tablet, Wear OS, Android TV, or Automotive OS device that you want to simulate in the Android Emulator. 


The AVD Manager is an interface you can launch from Android Studio that helps you create and manage AVDs.



So, how to create an AVD? And then how to run an emulator that uses the AVD?


1. Open the AVD Manager by clicking 'Tools > AVD Manager' from the Android Studio.


2. Click 'Create Virtual Device', at the bottom of the AVD Manager dialog.

    The 'Select Hardware' page then appears.


3. Notice that only some hardware profiles are indicated to include Play Store. 

    Pay attention to those hardware profiles labeled with the Google Play logo in the Play Store column. This indicates that these profiles are fully CTS compliant and may use system images that include the Play Store app.


4. Select a hardware profile, and then click 'Next'.

    Here we select 'Phone' - 'Pixel 2, 5.0", 1080x1920, 420dpi'.


5. The 'System Image' page now appears.


A system image labeled with Google APIs includes access to Google Play services. A system image labeled with Google Play includes the Google Play Store app and access to Google Play services, including a Google Play tab in the Extended controls dialog that provides a convenient button for updating Google Play services on the device.


Select the system image for a particular API level, and then click 'Next'.


Here we select the system image 'Q, API Level = 29, ABI = x86, Target = Android 10.0 (Google Play)'.


6. The 'Verify Configuration' page appears.

    Here we enter the AVD Name: Pixel 2 API 29(Android 10).


7. In the 'Your Virtual Devices' page, now we can find the AVD that we just created.

To run an emulator that uses the AVD, from the 'Your Virtual Devices' page, just double-click that AVD, or click Launch button for it.


Several minutes later, an emulator that you want will be up and running. 😎




Reference to the official Android Developer Website -