Black Screen with Android Emulator - android

I am a newbie to android development and am running Ubuntu Linux with an AMD cpu. I installed Android Studio, JDK, SDK, etc, and have been trying to run the emulator. However, whenever I try launching the emulator, it stays a black screen. The message I repeatedly get in terminal is
WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
I have tried waiting for a while, I have tried updating it, I have tried different APIs, I have tried setting emulated performance to software, and everything else I could find online. Help would be greatly appreciated!
Specs:
Ubuntu 16.04 LTS
Android Studio 2.3.3
Radeon R9 270x 4gb
AMD FX4100
32g ram
SVM is enabled in BIOS

This happened to me recently (emulator with black screen, with all AVDs, even those which worked previously), maybe after some system or Android SDK updates.
How I fixed it:
delete whole .android directory (is in your home directory) - backup this directory before deleting (it contains your AVDs, your debug signing key or other things you might wish to return to later) - yes, this was the thing that really helped
create new AVD - you have to do this after deleting that .android directory (it did not work if I copied backed up AVD back there)
For reference, here is AVD configuration which works for me now (created directly using Android SDK, not using the wizard in Android Studio):
Device: Nexus One (3.7", 480 x 800: hdpi)
Target: Android 7.0 - API Level 24
CPU/ABI: Intel Atom (x86_64)
Keyboard: [x] Hardware keyboard present
Skin: Skin with dynamic hardware controls
Front Camera: None
Back Camera: None
RAM: 1024
VM Heap: 64
Internal Storage: 200 MiB
SD Card: (empty)
[ ] Snapshot (unchecked)
[ ] Use Host GPU (unchecked)

Related

Android Emulator causing Blue Screen

Whenever I am trying to run the Android Emulator (any Nougat, Oreo, or Kitkat) laptop throws a blue screen saying STOP CODE IRQL NOT LESS OR EQUAL.
My laptop will restart in 20 minutes or so and I can do everything else on my laptop and even run the Android app on my mobile using USB Debugging.
I tried reinstalling android studio and AVD manager several times but my issue is not getting resolved.
PLEASE help!
Laptop Configuration:
Dell Inspiron 3576
Processor: Intel(R) Core(TM) i5-8250U CPU # 1.60GHz 1.80 GHz
RAM: 8.00 GB (7.87 GB usable)
System Type: 64-bit operating system, x64-based processor
Edition: Windows 10 Home Single Language
Version: 20H2 (as of 01st April, 2021)
I had the same issue with NoxPlayer which is another android emulator, the stopcode was different but it was fixed when I created a new boot entry with Hyper-V Disabled.
Check this out:
https://blog.nicholasrogoff.com/2013/12/27/create-a-no-hyper-v-boot-option/
"Don't forget to change Windows8 to windows10 in your commands, That's just a name but it has to be meaningful :D"

Android Emulator very slow on Ubuntu 20.04

My Android emulator runs very slow on my Ubuntu machine. I need it to run faster, because some apps are slowed down so much, that they change their behaviour (they use the camera).
System specs:
-x86_64
-Intel(R) Core(TM) i7-5600U CPU # 2.60 GHz
-20GB Ram
-512Gb HDD
I use Ubuntu 20.04 and Android Studio 4.1.1 (fresh installation).
I use this AVD: Pixel2 1080 x 1920: 420dpi API 28 Android 9.0 (Google X86_ARM) CPU/ABI: x86
In the extended menu I chose Graphics: Hardware - GLES 2.0. I also disabled GPS, audioInput and audioOutput with no performance improvements.
I did not try this, because selecting Hardware - GLES 2.0 worked for me and the avd started normally (but still very slow).
Other system images are equally slow though.
I tried:
sudo modprobe msr
sudo rdmsr 0x3A
and it returns 5, so VT-X is enabled
Is the hardware the bottleneck, or is something configured wrongly? Maybe it is the HDD that slows the emulator down? I tried running the emulator on Windows and it's insanely fast. The windows machine is stronger though.
Update 11.12.2020:
I also verified my KVM installation using this command:
./emulator -avd Pixel2Api28Arm -accel-check
It returned this:
28Arm -accel-check
accel:
0
KVM (version 12) is installed and usable
accel
So this does not seem to be an issue.
I was having the same problem (KVM working, but slow x64 emulator on x64 host), and found a solution here, which is to disable automatic snapshot creation.
Run your emulator, and click on the three dots (...) to open the settings:
In the settings, click "Snapshots":
Switch to the "Settings" section on top:
Set "Auto-save current state to Quickboot" to No:
It'll ask you to restart the emulator, click Yes:

AVD errors with HAX on Android Studio 2.1

I have a Lenovo W540 Thinkpad with Windows 7 and 8 Gb ram.
I had an old version of Android Studio installed on C:
Since C: was small and have little space left, I uninstalled it, downloaded and installed Android Studio 2.1 on D:
Wanted to run Instrumentation test sample in the emulator.
(https://github.com/googlesamples/android-testing/tree/master/unit/BasicUnitAndroidTest)
Created a default Nexus 5X AVD. Tried to run.
Constantly get AVD errors. Tried setting the memory sizes manually but to no avail.
Do I need to uninstall HAX and reinstall on D:? (is it even possible)
Cannot launch AVD in emulator. Output: Hax is enabled Warning:
requested ram_size 1024M too big, reduced to 512M
qemu-system-x86_64.exe: -drive
if=none,index=1,id=cache,file=C:\Users\aphilip.android\avd\Nexus_5X_API_22_1.avd/cache.img:
could not open disk image
C:\Users\my.android\avd\Nexus_5X_API_22_1.avd/cache.img: Could
not open
'C:\Users\my.android\avd\Nexus_5X_API_22_1.avd/cache.img':
Invalid argument
Update:
It works now after
I created environment variable in Computer|Properties ANDROID_SDK_HOME=D:\
Deleted HAXM and reinstalled
moved .android to D:
It works now after
I created environment variable in Computer|Properties ANDROID_SDK_HOME=D:\
Deleted HAXM and reinstalled
moved .android to D:

emulator-x86.exe has stopped working after lauching

I am using Android Studio in Windows 8.1 with 4 GB RAM; given 2 GB to virtual memory. But when ever I run the emulator I get the following:
C:\Users\CSE\AppData\Local\Android\sdk\tools\emulator.exe -avd Android_API_21 -netspeed full -netdelay none
emulator: device fd:828
HAX is working and emulator runs in fast virt mode
emulator: warning: opening audio input failed
creating window 0 0 384 729
emulator: emulator window was out of view and was recentered
The emulator starts and suddenly stops showing massage:
emulator-x86.exe has stopped working
I have edited the current device & also created new AVD with resolution 800x600 and RAM 512 MB ( & less ) but nothing works. HMAX is installed.
Suggestions will be really helpful. Thanks in advance.
Here is how I solved in a laptop with Windows 10 + HAXM enabled, to run the default "Nexus 5 API 23 x86" Device.
My laptop has 2 video cards, the integrated Intel HD 3000 and a GeForce 525M.
On NVIDIA Control Panel, switch "Preferred graphics processor" to Auto-select or Integrated graphics.
The emulator doesn't work here when I set the NVIDIA GPU as preferred.
Check this path
C:\Users\Username.android\avd. Edit the file emulator-user & set the window.x = 0, window.y = 0
Create the hdpi virtual device like Nexus S 4.0 480x800 hdpi.
In AVD Manager, Select your device which is stopped. And click the edit in the right side of the wizard. It shows the options and features of your current device like ROM size, Internal and External Storage etc.
Uncheck the Use Host GPU.
In that wizard select Show Advanced Settings -> Memory and Storage -> RAM: 764MB
VM heap: 32MB
Internal Storage: 200MB
Change these settings and restart your Android Studio

Android x86 + VirtualBox

I try to install android x86 4.2 (I tried also 4.0 asus laptop and eeepc) to my VirtualBox. My pc configuration:
Windows 7 x64
Lenovo Y570, Intel Core i7
NTFS file system
What I create in VirtualBox:
Name: Android x86
Type: Other (I tried Linux 2.4 x86 or Linux 2.6 x86 too)
Version: Other/Unknow
RAM: 512 Mb
Create a virtual hard drive => VDI (or HDD) => Fixed size (or dynamically) => 3 Gb (or 6)
Than I start my device and see boot menu. If I try to run it without installation, I see
Detecting Android-x86... found at /dev/sr0
Warning: Not an ASUS product
A N D R O I D
and nothing more happens. But now it must run like in different tutorials.
If I install, I try to format my Primary/Logical Bootable/Unbootable disk (FS type is Linux) from Choose Partition => Create/Modify partition.
I see very quickly disappearing line "could not find valid v7 on sda", than I see "can not mount /dev/sda1 Do you want to format it?" And I again go to Choose Partition menu.
Why emulator does not run?
Edited.
Answer: It's just a destiny. I installed VBox on my big pc with Win7 x32 and all is fine. On my Lenovo with the same config but with Win7 x64 it does not work. If u really wanna good android emulator, u can try YouWave.
I have HP430 Laptop with win 7. I had the same problem. But I figured out the solution.
While booting the computer with win7 I entered BIOS menu. There was a option to optimize pc for virtualization.I selected it. After that every thing ran smooth.
Later I noticed in virtual box that, in system settings the acceleration type was VT-x AMD, Nested Paging,PAE/NX. This was different before optimization.
Hope this gives some idea.

Categories

Resources