Create emulator in Linux Virtual machine through terminal using docker for android
Set Java:
1. Use Java 11 or 17 Instead of Java 18
SDK Manager works best with Java 11 or Java 17. Java 18 is not officially supported for Android SDK tools.
Run the following command to check your Java version:
Now, try running the sdkmanager
command again.
2. Install android image using sdkmanager
sdkmanager "system-images;android-34;google_apis;arm64-v8a" --sdk_root=/opt/android-sdk
if sdkmanger is not found in emulator
root@dee16e24c043:/# ${ANDROID_SDK_ROOT}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --licenses
3. Create emulator using avdmanager
avdmanager create avd -n MyEmulator -k "system-images;android-34;google_apis_playstore;x86_64" --device "pixel_5"
4. Launch the Emulator
root@dee16e24c043:/# emulator -avd MyEmulator -no-snapshot -noaudio -no-boot-anim
5. Install kvm if emulator not launched
sudo apt update
sudo apt install -y cpu-checker
kvm-ok
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
Run the Emulator with Software Rendering (Slow Alternative)
emulator -avd MyEmulator -no-accel -gpu swiftshader
Error 1:
error "WARNING | File System is not ext4, disable QuickbootFileBacked feature ERROR | x86_64 emulation currently requires hardware acceleration! CPU acceleration status: KVM requires a CPU that supports vmx or svm More info on configuring VM acceleration on Linux: https://developer.android.com/studio/run/emulator-acceleration#vm-linux General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration." when use "emulator -avd MyEmulator -no-snapshot -noaudio -no-boot-anim"
The error "x86_64 emulation currently requires hardware acceleration!" means that your system lacks the necessary hardware acceleration for running an x86-based Android emulator. Here's how to fix it:
1. Check If Your CPU Supports Virtualization
Run the following command to check if your CPU supports virtualization (VT-x for Intel, AMD-V for AMD):
- If the output is 0, your CPU does not support virtualization, and you can't run the x86 emulator.
- If the output is 1 or more, virtualization is supported, but it may not be enabled in BIOS.
2. Enable Virtualization in BIOS
If virtualization is supported but disabled:
- Restart your system and enter BIOS/UEFI (usually by pressing F2, F10, DEL, or ESC at boot).
- Look for Intel VT-x (for Intel CPUs) or AMD-V (for AMD CPUs).
- Enable the virtualization feature.
- Save and exit BIOS.
- Boot into Linux and check again using:
3. Install and Enable KVM for Hardware Acceleration
If you're using an AMD Ryzen processor (which you are), you need KVM (Kernel-based Virtual Machine):
(A) Install KVM and Required Packages
(B) Check if KVM is Working
If you see:
KVM acceleration can be used then your system is ready.
If KVM is not enabled, try:
and check again.
4. Use an ARM-based System Image Instead of x86_64
If your CPU does not support virtualization, you can use an ARM64 system image instead:
Then create an emulator using the ARM64 image:
And launch it:
5. Run the Emulator with Software Rendering (Slow Alternative)
If you cannot enable virtualization, try running the emulator in software mode:
This will be slow but allows the emulator to run.
6. Check Your File System (ext4 Warning)
You're also getting:
"File System is not ext4, disable QuickbootFileBacked feature"
This means your file system is not ext4 (e.g., Btrfs or XFS).
You can disable Quickboot by running:
Comments
Post a Comment