Cannot launch AVD in emulator in android studio .Invalid argument - android

I have a problem with emulator in Android Studio 2.1.2.
When I try launching my AVD, I receive a message which says:
Cannot launch AVD in emulator.
Output:
Hax is enabled
The memory needed by this VM exceeds the driver limit.
Hax ram_size 0x60000000
HAX is not working and emulator runs in emulation mode.
qemu-system-i386.exe: -drive if=none,index=0,id=system,file=E:\Program Files\Android\Sdk/system-images\android-24\google_apis\x86/system.img,read-only: could not open disk image E:\Program Files\Android\Sdk/system-images\android-24\google_apis\x86/system.img: Could not open 'E:\Program Files\Android\Sdk/system-images\android-24\google_apis\x86/system.img': Invalid argument
I don't know what to do.
Please give me some help.

The way I solved it is by setting the AVD memory limit and HAXM memory to be equal in size which is 1 GB = 1024 MB. The AVD cannot have higher memory limit than the HAXM.
1. Setting the HAXM memory to be 1024 M
The only way to change the HAXM memory is by installing it again. I did it using the terminal. Locate Hardware_Accelerated_Execution_Manager in your machine. Then change directory that folder to run the installation script.
cd ~/Library/Android/sdk/extras/intel/Hardware_Accelerated_Execution_Manager
-OR-
cd ~/Library/Developer/Xamarin/android-sdk-macosx/extras/intel/Hardware_Accelerated_Execution_Manager
May need to change permissions:
sudo chmod 755 "HAXM installation"
Then:
./HAXM\ installation -m 1024
-OR-
sudo ./"HAXM installation" -m 1024
2. Setting the virtual device the same size with HAXM memory limit
This works for me. Good luck!

Related

Hello World Android App Emulator not running

Hi guys I am trying to get a basic emulator running to display Hello World but the emulator appears but the phone never switches on. Please help me.
D:\Installed_Softwares\AndroidSDK\tools\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_24_2
ERROR: resizing partition e2fsck failed with exit code 9
emulator: WARNING: userdata partition is resized from 513 M to 800 M
RegGetValueW failed 2 The system cannot find the file specified.
RegGetValueW failed 2 The system cannot find the file specified.
RegGetValueW failed 2 The system cannot find the file specified.
Hax is enabled
Hax ram_size 0x60000000
HAX is working and emulator runs in fast virt mode.
emulator: Listening for console connections on port: 5554
emulator: Serial number of this emulator (for ADB): emulator-5554
Will be glad to provide more information as needed.
If you are using Windows, you have to resize (downgrade) the RAM of your emulator uses.
Also, try to use an older version of the Android, like 4.2 or 4.4.
To solve the partition issue on Windows:
Install Cygwin and run the e2fsck cmd
# Navigate to AVD and change the API level of the folder
cd C:\Users\%USERNAME%\.android\avd\Nexus_5_API_16.avd
e2fsck -f userdata-qemu.img

Android SDK. Can't start AVD

Problem:
I'm using only command line tools. AVD just worked fine some time ago. Now with various configurations I get only "Starting emulator for AVD..." which simply closes without any error messages and leaving emulator.exe in Task Manager for eternity.
What I've tried:
Various devices, API's, RAM above and below 768, with/without Host
GPU etc;
Reinstall Java;
Reinstall Android SDK;
Run emulator from command line just launches emulator.exe without any errors;
Delete .android folder in User's folder;
Set ANDROID_SDK_HOME variable;
Run SDK Manager.exe/AVD Manager.exe with/without elevated Admin rights;
verbose key gives me the following log:
emulator:Found AVD name 'jkll'
emulator:Found AVD target architecture: arm
emulator:Auto-config: -engine classic (arm default)
emulator:Looking for emulator-arm to emulate 'arm' CPU
emulator:Probing program: C:\Soft\Android\android-sdk\tools/emulator-arm.exe
emulator:return result: C:\Soft\Android\android-sdk\tools/emulator-arm.exe
emulator:Found target-specific 32-bit emulator binary: C:\Soft\Android\android-sdk\tools/emulator-arm.exe
emulator:Adding library search path: 'C:\Soft\Android\android-sdk\tools/lib'
emulator: Found directory: C:\Soft\Android\android-sdk/add-ons\addon-google_apis-google-17\images\armeabi-v7a\
emulator: Found directory: C:\Soft\Android\android-sdk/add-ons\addon-google_apis-google-17\images\armeabi-v7a\
Configuration I am working on:
Windows 10 x64
Android SDK Manager 25.1.1
Java JDK 8 Update 91
i5 CPU with 24GB of RAM
Any suggestions? TY.
I tried all the mentioned solutions. But strangely, I reduced my windows 10 laptop's resolution (from 3840 x 2160 to 1360 x 768) and it worked.
With your verbose I found you are using arm architecture devices.As you are using i5 processor,Windows10 x64 I would Suggest you to use x86 or x86-64 architecture for your devices for this you have to Install Intel x86 Emulator Accelerator (HAXM) from SDkManager.
Hope this helps let me know.
After changed the CPU of my computer and updated sdk, I encounter this problem too.
Now I temporarily solve the problem emulator-x86 I get an error about missing Qt5Core.dll, Qt5Widgets.dll and Qt5Gui.dl:
copy *.dll files in sdk\tools\lib\qt\lib to sdk\tools where the emulator-x86.exe in.

HAXM configuration in android studio

I tried to run a simple Android chat app from GitHub. I think there's a problem with my HAXM configuration. When I run the app I see these errors:
HAXM is not working and emulator runs in emulation mode
emulator The memory needed by this AVD exceeds the max specified in your HAXM configuration.
emulator: AVD RAM size = 1536 MB
emulator: HAXM max RAM size = 768 MB
emulator: You might want to adjust your AVD RAM size and/or HAXM configuration to run in fast virt mode.
emulator: warning: opening audio output failed creating window 61 83 462 820
emulator: emulator window was out of view and was recentered
What is wrong?
Reinstall HAXM with more RAM:
sudo $ANDROID_SDK/sdk/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh -u
sudo $ANDROID_SDK/sdk/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh -m 1024
your HAXM RAM is lower than your AVD RAM.
Solutions:
Re-run you HAXM installation and increase RAM to match that of AVD(emulator).
Alternatively, decrease RAM of AVD(emulator) to match that of HAXM.
The memory needed by this AVD should not be exceeds the max specified in your HAXM configuration.
It should be less than RAM set for HAMX.
Go to ~\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager \intelhamx_android.exe.
Reinstall intel HAXM and set its RAM to 1024MB.
Edit your AVD set its RAM to 768MB.
Build and run your application.
If you cant change the RAM via reinstalling it means you installed HAXM via Android Studios.
Ctrl + Alt + S
click on SDK Tools
uncheck the box for Intel HAXM (Intel HAXM Installer)
click Apply
recheck the box for Intel HAXM and the program should now ask you to reenter the RAM Usage via slider or number
Be sure when you increase your HAXM RAM configuration that your computer is able to handle this increased RAM. I use a 4GB RAM macbook pro that almost stopped responding after I increased HAXM RAM to 2GB. It may be a better option to decrease your AVD RAM.
After re-installing HAXM with more (ideally more than 1536 MB) space solves the problem.
How to install HAXM for MAC -
https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-mac-os-x
How to install HAXM for Windows -
https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows
Just go to:-
Help >> Edit Custom VM options >> (see the picture below) >> Then close the file >> Restart android studio
You have to increase the amount of RAM memory in:
Tools >> Android >> AVD manager
Select your AVD, press "Edit this AVD" and under Advanced settings set the amount of RAM to i.e. 1500Mb
That will do the trick

Mac HAX is not working and emulator runs in emulation mode

I have been running to the following error with Latest Android Studio.
emulator: The memory needed by this VM exceeds the driver limit. HAX
is not working and emulator runs in emulation mode
I am using Mac Pro with OS 10.1.xx
I have also executed required intel drivers and confirming the installation by running the following command in Terminal Console.
kextstat | grep intel
But I am still getting the same error.
Please help.
Amount of memory when you installed HAXM and amount of memory of your emulator device? If you set 1 gb ram when you installed HAXM and your device has 1536 for example, haxm cant works.
Try reducing the Ram of your Virtual Device to the one on HAXM and it should work!!! To do that go to Tool->andriod->Avd and then select your device and click on pen . go to Advance and locate the Ram option and reduce it from there

Android 5.0 emulator showing Storage space running out

I just updated Android SDK to version 21 and trying to start emulator. I am using Nexus 4 with CPU Intel atom (x86) 768 RAM and 524 internal storage. Emulator starts fine but it shows en error message, "Storage space running out" and it is very slow. I tried increasing the RAM also but didn't work. What could be the issue?
Open AVD Manager --> Wipe Data
You have to go in your android folder e.g. on OSX ~/.android/avd/{YOUR_AVD_NAME} and edit file config.ini.
Just add or modify row disk.dataPartition.size = YOUR_SIZE
e.g. disk.dataPartition.size = 1G
Then you may have to wipe your emulator's disk.
emulator -avd "Name" -partition-size 500
This solved the issue for me.
Update on how to execute above command:
Go to a terminal
cd [android SDK directory]/tools/
linux terminal: ./emulator -avd nameOfAvd -partition-size 500 &
windows : emulator -avd nameOfAvd -partition-size 500
Go to AVD manager on your android studio.
click on the pencil icon of the virtual device.
on the pop up window click on advanced settings at the bottom.
scroll down to memory and storage and alter the default definitions of MB/GB etc.
REinstal the emulator..
Go to your AVD location and delete all the files in avd folder( C:\Users\acer.android\avd ),
then Go to android studio AVD Manager and install a new emulator.
( but this will erase the current emulator so, you'll need to download it again..)

Categories

Resources