Android Emulator freezes - android

Until the last SDK release, my Android Emulator worked very nice with x86 architecture, installing Intel HAXM and enabling GPU for the device in AVD Manager.
With the latest SDK release, I reinstalled my Windows (from 8.0 to 8.1), tried both 1.06 and 1.07 Intel HAXM and my app freezes quite frequently.
It doesn't freeze to death, just the freezes/does not updates the screen anymore.
Especially if I'm swiping a ViewPager, then it freezes almost always in between pages.
BUT, if I click a menuitem on the AppBar, it refreshes itself and draws the destination ViewPage page.
I'd appreciate any advice, because right now app development via emulator became ultrapainful.

My emulator froze and I couldn't fix it with the other answers, but this solved it:
Tools->AVD Manager
In the Actions column for your virtual device, click the white arrow on the right and then click Wipe Data.
This will clear the cache for the virtual device.
If your app depends on Google Play services, you will need to update it again

Try this:
In the Android Virtual Device (AVD) settings, select
- edit this AVD, then click
- show advanced setting then
- DISABLE multi-core CPU.

In the Android Virtual Device (AVD) settings, turn off the Use Host GPU emulation option. Unfortunately, the resulting slowness is often worse than the freezing.

Before doing the steps you need to delete the .lock folder under the C:\Users\user\.android\avd\yourEmulatorName\ path, To go there just simply click Show on Desk .Then -
Step 1: Go to AVD Manager and click the drop-down and select Stop. The emulator will be stopped then.
Step 2: Then click the Cold Boot Now

Use the free Visual Studio Emulator for Android. It's very fast, and despite its name, does not require you to work in Visual Studio to use it. Android Studio and Eclipse happily detect it as the running emulator.

Setting Boot option to Cold boot worked like a charm for me. Absolutely no idea why.
Also disabling advanced profiling helped me with older versions (API 21).

What helped me was to use a lower version of SDK in emulator, namely the SDK version 31 (image "S")
Please note the date I'm writing this, if you are seeing this in the future try lowering your version acccordingly

stop the emulator and go to C:\Users\YOUR_USER\.android\avd\Pixel_6_Pro_Edited_API_33.avd and delete
version_num.cache
cache.img.qcow2
cache.img
multiinstance.lock
hardware-qemu.ini.lock
AVD.conf
it will work

Try giving virtual device less RAM.
Android froze on start with 4GB (=4096MB) RAM but did not freeze with 3GB (=3072MB).
Note: I'm using Android Studio on Linux Mint 21.1.

From the Android SDK Manager, install Intel x86 Emulator Accelerator (HAXM installer) revision 5 or later, and then run sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.msi to update the drivers on your PC. This is version 1.1.0 of the accelerator, which seems to fix the freezing bug.

Try this :
sdk\tools\emulator.EXE -partition-size 512 -noaudio -no-boot-anim -avd Nexus5XAPI25 -prop monodroid.avdname=Nexus5XAPI25
After I added -noaudio option,it's ok

Related

Android Studio Emulator and "Process finished with exit code 0"

I've updated android studio from 3.0 to 3.0.1 but when I launch Emulator it didn't get launched and gives message in event log:
Emulator: Process finished with exit code 0
You need to check:
Your size on disk is not full - this's often happen due to creation of some virtual devices that are unused
The RAM size of emulator is not minimum as your requirements
One more thing that I personally use: Use Pen Drive as a RAM
Updated:
Use HDD as RAM
Right Click on “This PC or My Computer” and Select Properties.
Now Click on “Advance System Settings”.
Now in “System Properties” you have to select “Advanced” tab.
Now click on “Settings” Under “Performance”.
Now in “Performance Option” again you have to select “Advanced” tab.
Now click on “change“ under “Virtual Memory”.
Un-check “Automatically manage paging file size of all drivers” and select “Custom size”.
In Custom Size enter the amount of data According to “Space available” which is written there.
Click on “set” button and Click on OK.
Now it will ask you to restart your Computer or Laptop.
Another work around steps (tested) :
Restart your Android Studio
Create new device in your AVD Manager
Increase the RAM size of the Emulator
I restarted Android Studio and create a new device in AVD MANAGER then I have increased the RAM size of emulator and it works nicely.
UPDATED
Sometimes it happens when you close emulator during building the App in to emulator.
I also faced the same error. After a few hours I figured it out.
I hope it helps you :
Go to Tools ==> SDK Menager ==>Android SDK
(Appearange&Behavior=>System settings=>Android SDK)==>SDK Tools==>Intel x86 Emulator Accelerator(install this).
It will solve your problem.I hope it helps.
I had this problem and it took me nearly 2 days to resolve...
I had moved my SDK location, due to the system drive being full, and it seems that someone, somewhere at Android Studio central has hard-coded the path to the HaxM driver installer. As my HamX driver was out of date, the emulator wouldn't start.
Solution: navigate to [your sdk location]\extras\intel\Hardware_Accelerated_Execution_Manager and run the intelhaxm-android.exe installer to update yourself to the latest driver.
I had this issue in Android Studio 3.1 :
I only have on board graphics. Went to Tools -> AVD Manager -> (Edit this AVD) under Actions -> Emulated Performance (Graphics): select "Software GLES 2.0".
In AVD Manager,
Go to Edit Icon on AVD Manager for selected Device.
Click on show advanced settings and increase ram size from 1500 mb to 2 GB.
Then it works.
NOTE: Some virtual devices do not allow you to update RAM, but if so, try installing Nexus 4. because it does.
NOTE2: If still doesnt work, dont give up. just uninstall and reinstall the device with changing RAM again. in some cases this is how it works
NOTE3: If still doesnt work, this means your pc doesnt have enough ram space. so increase the ram to 3gb. it might work but it will suffer
NOTE4: If still doesnt work, try it with multicore 2 instead of 4.
NOTE5: Still doesnt work. Close the Android Studio and NEVER open it back :)
Docker installation selected Hyper-V on windows by default. Deselect the Hyper-v b
This worked for me.
I was able to get past this by making sure all my SDKs were up to date. (Mac OS 10.13.3, Android Studio 3.0.1). I went to Android Studio -> Check for Updates... and let it run. Once my Android 5.0/5.1 (API level 21/22) SDKs were updated to revision 2:
After doing this update, I was able to run the emulator without crashing out immediately with a "Emulator: Process finished with exit code 0" error.
None of the solutions worked for me. I upgraded my previous Android Studio to 3.0.1 and received this issue while trying to restart the emulator.
What worked for me was deleting Android Studio from Windows 'Add or Remove Programs'. Then go to C:\Users[User] and delete any android-related folders (.android, .AndroidStudioX.X, Android).
Next go to C:\Users[User]\AppData\Local and delete any Android-related folders there. Restart your system and re-download android studio from their official site (https://developer.android.com/studio/index.html). Install Android Studio from fresh and don't import any old settings.
When Android Studio finishes installing, I launched AVD from 'Tools > Android > AVD Manager', created a pixel 2 device with 4096mb of RAM running Android API P x86. Start it up and it works!
This can be solved by the following step:
Please ensure "Windows Hypervisor Platform" is installed. If it's not installed, install it, restart your computer and you will be good to go.
Android Studio Emulator: Process finished with exit code 1. Maybe disk drive is FULL. You can delete some virtual devices unused. It works for me.
it's next to the edit in your virtual manager devices menu (the arrow down)
I also had the same problem.I fix this problem by editing Graphics of AVD.
Tools > Androids > AVD Manager > Actions > Edit > Show Advance Settings > Graphics -> Software.
I hope this solution help u!
You can try to delete the emulator and reinstall it this usually does the trick for me. Sometimes you also run into hiccups on your computer so try restarting your computer. Your computer may not be able to handle android studio if so there is nothing you can do. Consequently, you may not have the right ram requirements. Finally, If all else fails you can try to delete then reinstall android studio.
I solved this issue by offing all of advantage features of my graphics card in its settings(Nvidaa type). It started to throw such hanging error less a lot. But finally I found a simplier way: In avd manager you need to put less resolution for the avd. Say, 400x800. Then I reenabled graphics card features again and now it runs all ok. (I suspect my graphics card or cpu are weaker than needed. )
In my case, Emulator: Process finished with exit code 0 error started after I pressed on Restart in the Emulator.
It happened because in Android Studio 3.0 and up versions, the emulator saves the states of the current screen to launch it very quickly at next time. So when I pressed on Restart it closes emulator by saving state as Restart. So when I launch/start the emulator, it executes the Save States as Restart and then after emulator is not started automatically. So basically it stuck in to Save States of Restart.
I don't want to delete existing emulator and create a new one.
My default Boot Option of Emulator was Quick boot in AVD.
By doing Cold Boot Now from AVD (Android Virtual Device) Manager, it starts emulator again in normal mode without Save State.
Cold boot start emulator as from power up.
I was getting the following error when starting the emulator and none of the answers fixed it.
Emulator: Process finished with exit code -1073741515 (0xC0000135)
Finally I found that Visual C++ is not installed in my system. If it is not installed please install Visual C++ and check.
Please find the link below to download latest Visual C++.
https://support.microsoft.com/en-in/help/2977003/the-latest-supported-visual-c-downloads

Android Emulator won't starting up

I just installed Intel HAXM and updated my Android SDK Tools to revision 24.1.2 successfully. Then I restarted my PC, and ran the emulator. Unfortunately, I my emulator won't starting up, always stuck. Waiting for ~1 hour, the emulator still getting stuck. Sometimes the screen was black, didn't show anything even the ANDROID logo while emulator was booting (full of black color). My screenshot:
The second problem is, as you can see in the figure, this is an abnormal behavior. There's no title bar, because it hides on the top of my desktop. So I can't move the emulator window to the center of my desktop.
From the Console, it seems that Android Studio is waiting for the emulator to finish its start up:
What have I tried:
Restarted my PC.
Followed this answer.
Check and uncheck Use host GPU option in AVD.
Re-build my emulator in AVD.
Closed the emulator and ran it again.
Changed CPU/ABI to ARM and Intel Atom x86 in AVD.
Can you help me to solve these problems?
Have you tried with a different\more recent Android version?
I suggest you to switch to Genymotion.
It's free for personal use and it very better than AVD: it's faster, you can drag and drop files and much more.
I asked my mom to pray for me to solve these problems, and I found the solution then, hehe :P
So these problems happened because of the skin of emulator I selected in AVD was WQVGA432. Then I changed (edited) the emulator's skin in AVD to WQVGA400 and WQVGA800 to test the result, and it really works for both of them. I think, the only skin which has broken is WQVGA432. If you also had these problems, I suggest you to never select WQVGA432 skin or try another skins.
Now, I can move the emulator window normally and debug my app.
Try updating Android Studio and re-download the image file from SDK

Android Studio shows black screen when running

I have a problem when running the applications in Android Studio as everytime it shows only a black screen where it's written Android and that's all. Any ideas why it's doing this and how I can solve it?
1) Go to SDK Manager->Extra->intel x86 Emulator Accelerator (HAXM installer) and check is it installed or not? if it is not installed then install it.
2) Allow Virtualization in BIOS setting.
But i suggest you to use GenyMotion to run your Android Application. Here is link [https://www.genymotion.com]. It is FAST,SIMPLE and POWERFUL.
When the emulator isn't booting it's mostly a driver problem.
Make sure you have all your windows updates, since windows by default also updates essential drivers. This happenes more often when you have an illegal version of windows.
Or download driver software that automatically updates your drivers.
Also downloading the "Visual C++ Redistributable for Visual Studio"'s worked for me, but I did not try this whithout my full update.

Emulator in Android Studio doesn't start

I think it's a problem with the SDK reference in Project Structure, but when I click run and I choose Launch Emulator nothing appears.
I had the same problem. I just created the AVD with 768 MB RAM and it did run fine!
UPDATE: November 2022
This answer was almost from 10 years ago and will most propably not work on current version of Android Studio.
I had a similar problem... Android Emulator doesn't open.
You need to discover the reason of this... You could run your emulator from the command line. For this you could copy and paste your command line from "Run" or "AVD" Android Studio console.
For example:
"{path}\android-sdk\tools\emulator.exe -avd Default_Nexus_5 -netspeed
full -netdelay none"
When you launch it from a command line terminal, It give you a message with the error.
In my case it was useful for discover the problem:
..\android-sdk\tools>emulator: ERROR: x86 emulation
currently requires hardware acceleration! Please ensure Intel HAXM is
properly installed and usable. CPU acceleration status: HAX kernel
module is not installed!
I needed to activate GPU acceleration with a tool to enable it on my machine.
I solved it installing from SDK Manager the tool HAXM...
I had another problem... For example i had assigned a bad url for skin path of my virtual device...
To solve it I have configured my virtual device with a valid skin from my platform sdk: '{path}\android-sdk\platforms\android-{number}\skins{SCREEN_SIZE}'
Now it is opening fine.
Update 8/8/2019:
For newer version of Android SDK, emulator path should be:
"{path}\android-sdk\emulator\emulator.exe"
reference (thank you #CoolMind)
In my case the android hangs at start up. I solved by wiping user data and forcing a cold boot, using Android Virtual Device Manager (Tools->AVD Manager)
It seems that "Waiting for target device to come online ..." is a generic message that appears, always, when the emulator can not start properly. And what's the cause of that? As you can see, there could be many causes.
I think the best way to find the concrete error with the emulator is to start it within a terminal. So:
1 - Open a terminal and go to this folder:~/Android/Sdk/tools
2 - Start the emulator with this command:
./emulator -avd EMULATOR_NAME -netspeed full -netdelay none
You can see the name of your (previously created with AVD Manager) emulators with this command:
./emulator -list-avds
If everything is ok, the program doesn't start, and it writes in the terminal the concrete error.
In my case, the application says that there is a problem loading the graphic driver ("libGL error: unable to load driver: r600_dri.so"). As it is explained here, it seems that Google packaged with Android Studio an old version of one library, and the emulator fails when it tries to use my graphic card.
The solution? Very easy: to use the system libraries instead of the packaged in Android Studio. How? Adding "-use-system-libs" at the end of the command. So:
./emulator -avd EMULATOR_NAME -netspeed full -netdelay none -use-system-libs
The definitive solution is to set the ANDROID_EMULATOR_USE_SYSTEM_LIBS environment variable to 1 for your user/system. With this change, when I run the emulator within Android Studio, it will also load the system libraries.
PS 1 - The easiest way I found to set the environment variable, it's to modify the script that launches the Android Studio (studio.sh, in my case it is inside /opt/android-stuido/bin), and add at the beginning this:
export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
PS 2 - I work with Debian Jessie and Android Studio 2.2.3. My graphic card is an ATI Radeon HD 6850 by Sapphire.
UPDATE December 2017: I had the same problem with Debian Stretch and Android Studio 3.0.1 (same graphic card). The same solution works for me.
1) Open SDK Manager and Download Intel x86 Emulator Accelerator (HAXM installer) if you haven't.
2) Now go to your SDK directory (C:\users\username\AppData\Local\Android\sdk, generally). In this directory Go to extra > intel > Hardware_Accelerated_Execution_Manager and run the file named "intelhaxm-android.exe".
In case you get an error like "Intel virtualization technology (vt,vt-x) is not enabled". Go to your BIOS settings and enable Hardware Virtualization.
3) Restart Android Studio and then try to start the AVD again.
It might take a minute or 2 to show the emulator window.
If you are new to Android studio, you need to follow few basics steps in configuring the emulator.
Make sure you have proper SDK installed
Make sure you have Intel HAXM & virtualization option enabled in your BIOS
Configure emulator correctly, download the Intel X86 Atom system image for better performance.
Go through this blog, http://www.feelzdroid.com/2015/05/android-studio-emulator-not-working-solution.html
Here they have explained clearly, what are the problems you face while running & resolution for the same.
With Ubuntu, I had the same problem. I solved it by changing file /dev/kvm permission to 777:
sudo chmod 777 /dev/kvm
you need to install "Android Emulator"
Go to
SDK Manger -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools.
and set a hook at Android Emulator
I had the same issue in Android Studio 2.3.3 on Mac OS X 10.12.6 and the issue was caused by Android Studio using an old version of HAXM (6.0.3 when it should have been 6.2.1):
$ kextstat | grep intel
148 0 0xffffff7f8342c000 0x14000 0x14000 com.intel.kext.intelhaxm (6.0.3) 50449AFC-F7C6-38A0-B820-233E8A050FD6 <7 5 4 3 1>
Removing and reintalling HAXM from within Android Studio according to the instructions didn't work: https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-mac-os-x
Instead, download the HAXM installer manually or if that link expires, find it under https://software.intel.com/en-us/android/tools under Intel® Hardware Accelerated Execution Manager (Intel® HAXM).
After running the installer, it now shows that the current version of HAXM is installed:
$ kextstat | grep intel
169 0 0xffffff7f83472000 0x1d000 0x1d000 com.intel.kext.intelhaxm (6.2.1) 7B6ABC56-699C-3449-A0EC-BEB36C154E3C <7 5 4 3 1>
After upgrading HAXM manually, I'm able to launch x86_64 emulators.
Old answer, which might work instead (note that this didn't work for me for x86_64 images):
Create a new device:
Tools->Android->AVD Manager
+ Create Virtual Device
Tablet -> Nexus 7 -> Next
The Recommended tab should be highlighted.
Even though I had the API Level 25 SDK installed, it showed:
Nougat Download 25 x86 Android 7.1.1 (Google APIs)
So I clicked Download link which seems to have repaired the API Level 25 SDK. I finished creating my new device and it ran fine.
Unfortunately I had already deleted my old device, so if this works for someone else, please leave a comment here to let us know if your original device worked afterwards, thanks!
I'd like to post a link to this answer as it might help out any persons in this thread running into issues starting a virtual device with more then 768 mb of memory;
How to make an AVD with > 768MB RAM To emulate Galaxy devices
I have similar problem but I have solved it by switching to "Android 4.2.2 armeabi-v7a" (I needed to test it on Jelly Bean) in my AVD and it fixed the problem for me.
What seems to happen is that my processor is AMD and Intel X86 hardware emulation couldn't start. So I changed to use "API" other than "x86" (even though it recommended me to use x86). Hope this helps.
I spent several hours on this problem. What worked for me was opening the Tools->Android->SDK Manager, choosing Android SDK under System Settings on the left of the screen and going to the SDK tools tab. I then unchecked the settings for Android emulator and the Intel x86 Emulator Accelerator. I applied these changes, restarted Android Studio and then re-checked these option and applied the changes. The program reinstalled the emulator components and things seem to work. Hope this helps someone.
In Android Studio 2.3.3 I was able to get my AVD to start and run by changing Graphics in the Emulated Performance section from Automatic to Software-GLES 2.0:
I was able to infer this after following the advice at https://stackoverflow.com/a/44931679/1843329 and doing:
$ ./emulator -avd Nexus_4_API_21 -use-system-libs
which resulted in:
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.
And when I did:
./emulator -avd Nexus_4_API_21 -use-system-libs -gpu off
the emulator then launched.
Wipe data of AVD like that picture and run your program. it's work for me.
If anyone is still having trouble with launching the avm take note of the android studio event log when you try to run the avm. When I tried running the avm android studio mentioned that my environment variable ANDROID_SDK_HOME was set to the same place as ANDROID_HOME and it shouldn't be. It recommends deleting the variable ANDROID_SDK_HOME which I did and then restarted android studio and avm started working.
Access the BIOS setting and turn on the virtualization feature. Mine was together with options like cpu fan speeds and stuffs.
Then make sure that Hyper-V is turned off in the windows features ON/OFF.
Then reinstall the intel HAXM, this should fix this issue.
edit this file:
sudo nano .android/avd/your_emulator.avd/config.ini
change lines
hw.gpu.enabled = yes
hw.gpu.mode = auto
to
hw.gpu.enabled = no
hw.gpu.mode = off
It works for me !
just check out if you have this problem "vt-x is disabled in bios"
in this case you need to enable virtualization technology bios
It probably won't start because you
no CPU is installed, then follow this answer: Unable to create Android AVD because of Target and CPU/ABI settings?
OR
don't have the correct SDK downloaded
If you migrated your project from Eclipse chances are that on running an emulator you will get stuck with this message not seeing anything else:
Waiting for device.
If you open the device manager you probably see something like this:
Just recreate your devices.
I've faced similar problem. You can edit the configuration or create new AVD with higher RAM. Also try increasing Heap to 128. Emulator will work smoothly even without HAXM
I had the same problem. I just Created New AVD with 768 MB RAM and it did run fine for me. I Used for API 22(Lollipop Version).
Besides using an external emulator such as bluestacks, you can also create a new new AVD and choose a system image with an ABI of armeabi-v7a with an API level of 21, instead of choosing ABI of x86 which fails.
I was having the same problem, i tried this and it worked. hope this will be useful as well.
Check if the following tools are installed or not in the Android SDK Manager as shown in this picture:
One reason could be that the chosen ABI does not fit to your system. For me, only arm64 is working.
I had the same problem on Windows 10, after I moved my android-SDK folder to D:/ as I was low on space on c:/.
It turned out that the Android emulator looks for Android SDK via Global (environment) Variables, not the path defined inside Android Studio.
So I edited the Environment variable of ANDROID_HOME and that was it.
If your emulator worked fine but suddenly it doesn't, just restart the machine and run again.It worked for me.
I faced the same problem. From some research that I did, I realized that my computer does not support virtualization. So I had to install BLUESTACKS.
Believe me it worked...you can also try it.
Just go to your directory C:\Android\sdk\platform-tools and double click adb
Ensure that your bluestack is running.
When you try to run the project, it automatically shows up to run with the bluestacks....just choose the bluestack and you are done.
If you want the setup of bluestack, just google it you can have a number of sites to download from for free.
I performed the procedure below, and was successful.
Execute this command down.
npx react-native info
This command return the log file the npm (example)
C:\Users\Robinho\AppData\Local\npm-cache\_logs\2020-11-22T19_35_23_842Z-debug.log
In my case was permission in dir file in windows SO.
I restarted my computer clicked F1 for the Bios setting and checked the virtualization technology box and saved the changes. The AVD worked without glitches after my computer booted. This article explains it. Hope somebody finds this helpful.
I was having this same problem. I decided to create (see the button at the lower-left). I defined the image to match my device and that seems to work.
I am thinking with Android Studio at version 1.0.1, there are still plenty of bugs.

Why emulator is very slow in Android Studio?

I just setup Android Studio on my PC, which is new launch to develop Android application.
My problem is that, when I try to run my small app in emulator, it take to much time to launch and after then emulator is working slow too.
AVD settings
AVD Name: Glaxy
Device: Glaxy Nexus (4.65", 720x 1280: xhdpi)
Target: Android 4.2.2 - API Level 17
Memory Option: Ram 500, VM Heap 64
Internal Storage: 200MiB
I have good window pc: Intel Core 2 Duo 2.93Ghz and Ram is 3gb
I am new in Android development and java.
The Best Solution is to use Android Emulator with Intel Virtualization Technology.
Now if your system have a Processor that have a feature called as Intel Virtualization Technology, then Intel X86 images will be huge benefit for you. because it supports Intel® Hardware Accelerated Execution Manager (Intel® HAXM).
To check that your processor support HAXM or not : Click Here
You need to manually install the Intel HAXM in your system. Follow these steps for that.
First of all go to - adt -> extras -> intel -> Hardware_Accelerated_Execution_Manager
Make sure that Intel Virtualization is enabled from BIOS Settings.
Now install Intel HAXM in your system and select amount of memory(i prefer to set it as default value).
After installation create new Android Virtual Device (AVD) which should have a Target of API Level xx
Now set the CPU/ABI as Intel Atom(x86).
If you are on Windows then do not set RAM value more than 768 MB while setting up an emulator.
Run the emulator. It will be blazing fast then ordinary one.
Hope it will be helpful for you. :) Thanks.
Just edit the AVD settings as below,
Enable snapshot options and please use INTEL HAXM software for speedup.just visit https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm and download...
I tried all the suggested remedies and none had any impact. The Android Studio emulator experience was simply unusable with my setup (Windows 10, AndroidStudio 3.5, Quadcore 3.2 Ghz, 32GB with SSD drive).
I tried Updating Studio, Installing Intel HAXM, Changing the memory settings via SDK, using an actual device, excluding the various folders from in the Windows Anti-virus among other things.
The solution that made it work like a breeze was to exclude the Android Debug Bridge (adb.exe) "as a process" from the Windows Security / Virus Protection. You can either do it yourself or read the details below to know how to do it.
I suggest verifying the severity of the speed issue yourself. The same will be used to verify the difference immediately after you apply the remedy. Running the options from within Android Studio just makes it more complex.
Steps to check the issue:
Get the path for your Android SDK Tools. You can find it from SDK Manager -> Appearance and Behavior -> System Settings -> Android SDK.
Open a command prompt or terminal window. You can do right click on Windows (Start) Icon -> Run and execute "cmd". This should give you a windows command prompt or terminal window.
In the terminal window, change your drive and path to your Android SDK folder using the CD command. Now change to the sub-folder Platform-tools.
You will find the Android Debug Bridge (adb.exe) in this folder. This plays a very crucial role in operating the emulator as well as the actual device.
In the terminal window, execute the adb.exe tool with the command adb. It should instantly return back with the help parameters for adb.
Now execute adb.exe with a command like - adb devices. This should simply stall and take several seconds to come back with the information even if you have no devices or emulator running. In my setup it took almost 30 seconds. This is the issue.
Anything you do with the emulator goes via adb and gets stuck here. Once the remedy is applied, it should execute the adb devices command as instantly as the simple adb command without any parameter.
Steps to remedy:
Go to Windows "Virus and Threat Protection" setting. There are several ways to reach it. You can use Right Click on Windows (Start) Icon and choose Settings. Choose Update & Security, then Windows Security, then Virus and Threat Protection.
You will find the option Virus and Threat Protection Settings. Select it. You will find several options, look for Exclusions. Select the option Add or remove exclusions. This will take you to the list of Files, Folders, Processes which are presently excluded by the windows anti-virus. It may be empty or may have some data.
Select "+ Add an Exclusion". You will find 4 options - File, Folder, File Type and Process. This is critical. Please choose Process.
In the "Enter Process Name" input box type in the name adb.exe. Please dont forget to type in the extension, just putting adb will not work. Accept the input with "Add" button.
You are done. Now goto the command prompt again and follow the same steps you did earlier to check the issue. Hopefully you will be pleasantly surprised and your entire Android Studio emulator experience should become seamless.
Note that the steps may slightly vary depending upon your version of Windows, Android Studio and SDK tools however it should still apply.
The new Android Studio incorporates very significant performance improvements for the AVDs (emulated devices).
But when you initially install the Android Studio (or, when you update to a new version, such as Android Studio 2.0, which was recently released), the most important performance feature (at least if running on a Windows PC) is turned off by default. This is the HAXM emulator accelerator.
Open the Android SDK from the studio by selecting its icon from the top of the display (near the right side of the icons there), then select the SDKTools tab, and then check the box for the Intel x86 Emulator Accelerator (HAXM installer), click OK. Follow instructions to install the accelerator.
Be sure to completely exit Android Studio after installing, and then go to your SDK folder (C:\users\username\AppData\Local\extras\intel\Hardware_Accelerated_Execution_Manager, if you accepted the defaults). In this directory Go to extras\intel\Hardware_Accelerated_Execution_Manager and run the file named "intelhaxm-android.exe".
Then, re-enter the Studio, before running the AVD again.
Also, I found that when I updated from Android Studio 1.5 to version 2.0, I had to create entirely new AVDs, because all of my old ones ran so slowly as to be unusable (e.g., they were still booting up after five minutes - I never got one to completely boot). As soon as I created new ones, they ran quite well.
Check this: Why is the Android emulator so slow? How can we speed up the Android emulator?
Android Emulator is very slow on most computers, on that post you can read some suggestions to improve performance of emulator, or use android_x86 virtual machine
As #Xavi mentioned, Android Emulator is normally slow and lags a lot. Either test your app on an actual device or use an alternative emulator such as BlueStack or Android-X86.
Another tip for using emulator is to not close if you ain't done testing your application. Just leave it open. In this case you skip the time it takes to launch.
Use x86 images and download "Intel Hardware Accelerated Execution Manager" from the sdk manager.
See here how to enable it: http://developer.android.com/tools/devices/emulator.html#accel-vm
Your emulator will be super fast!
The emulator is much much faster when running on Linux. In Ubuntu 13.04, it launches within 10 seconds, and it runs nearly as smoothly as on a physical device. I haven't been able to reproduce the performance on Windows.
EDIT:
Actually, after the first boot, when using the Atom arch. and GPU acceleration, the Windows emulator runs nearly as well as in Linux.
Try increasing your ram of intel HAXM by reinstalling it..
Worked for me..
In my pc HAXM setup's location was here:
C-Users-Pc's_name-AppData-Local-Android-sdk-extras-intel-Hardware_Accelerated_Execution_Manager
Check this list:
install Intel HAXM
just use x86 AVD
use small size screen
I tend to load AVD through snapshot which can be setup in the AVD Manager > Choose AVD > Details... > Checking Emulator Options: Snapshot, and then to run the AVD, Select AVD in AVD Manager > Start... > Select Save To Snapshot and Launch from Snapshot. The first time, ensure that save to snapshot is chosen, as no snapshot exists to launch. The next time onwards choose launch from snapshot.
Slightly apprehensive to suggest this as well, but I have noticed a peculiar behavior when loading and running AVD. When I have the laptop battery being charged on my Lenovo laptop - 64 bit Windows 7, 4GB, 2.5GHz machine, the emulator loads and runs slightly faster and also lags less. I wonder if it is the configuration on my laptop to slow down high computational processes. Would be nice to know if someone else has noticed this behavior? Unplug the charger when the AVD is loaded and see if the AVD slows down.
A quick fix if using Android Studio (or Eclipse) is to disable the boot animation.
1) Select Run > Edit Configurations
2) Android Application > YOURAPP
3) Select the "Emulator" tab and check the "Disable boot animation"
This is will stop the "ANDROID" image from loading and boot directly to the lock screen, then keep your the emulator open. Also, to avoid problems, don't rotate the device before launch (Cmnd + Ctrl + F11), and don't try to run the app more than once during installation.
Android Development Tools (ADT) 9.0.0 (or later) has a feature that allows you to save state of the AVD (emulator), and you can start your emulator instantly. You have to enable this feature while creating a new AVD or you can just create it later by editing the AVD.
Also I have increased the Device RAM Size to 1024 which results in a very fast emulator.
Refer the given below screenshots for more information.
Creating a new AVD with the save snapshot feature.
Launching the emulator from the snapshot.
And for speeding up your emulator you can refer to
Speed up your Android Emulator!:
Try using another android virtual device. You can create one by adding a new device by going to the AVD Manager. Select the screen size 3'2 and API-10 (gingerbread).
This worked for me, and it is super-fast now.
P.S.- My laptop used to take forever to load the emulator, and It never got started due to insufficient memory(4.2). I used to get restart again and again. This solved my problem.
Google Launches Android Studio 2.0 With Improved Android Emulator And New Instant Run Feature
New Features in Android Studio 2.0 :
1.Instant Run: Faster Build & Deploy
You can quickly see your changes running on your device or emulator.
Enable Instant Run follow this steps:
1.open Settings/Preferences
2.go to Build, Execution, Deployment
3.Instant Run. Click on Enable Instant
Please see this video of Instant Run --> Instant Run
2.GPU Profiler
For developers who build graphics-intensive apps and games, the Studio now also includes a new GPU profiler. This will allow developers to see exactly what’s happening every time the screen draws a new image to trace performance issues.
click here for more details about the GPU Profiler tool
Getting Started Guide for Android Emulator Preview
For more detail about android 2.0 Biggest and best update of 2015 you can see very good article Author by #nuuneoi :
First Look at Android Emulator 2.0, the biggest and the best update yet in years
In my case, the problem was coming from the execution of WinSAT.exe (located in System32 folder). I disabled it and issue solved.
To turn it off:
Start > Task Scheduler (taskschd.msc)
Find Task Scheduler (Local)
Task Scheduler Library
Microsoft > Windows > Maintenance
Right click WinSAT
Select disable.
The Reference
Also, suppress it from Task Manager or simply reboot your machine.
Point: In this situation (when the problem comes from WinSAT) emulator works (with poor performance) when you use Software - GLES 2.0 and works with very very poor performance when you use Hardware - GLES 2.0.
Aside from what everyone has already said about HAXM and other configuration settings as solutions for this problem, my solution had nothing to do with software configuration or processor limitations.
I setup Android studio on an older HDD and I had Visual Studio running an android emulator on an SSD. My bottleneck was the old HDD - the SSD I had resulted in more speed.
The solution - albeit not the best for you - is to look in installing an SSD. This is not a very feasible solution in 90% of the cases but for me the root cause was linked to my hardware - not my software config.
Hope this helps another person facing a similar problem!
This worked for me. My size on disk was just too high for the emulator to run correctly. Wiping the data took it from 4.9 GB to 2.9 GB.
Click on the AVD manager at the top right and it will pull up a screen with all your devices. In row with your device the very last icon will be a drop down arrow, click it. Click 'Wipe Data' then 'Cold Boot'
For those who enabled HAXM and the emulator still works slow here is what you should do:
If Avast antivirus is running on your computer, it is most likely the culprit.
as per HAXM Release_Notes.txt (Version 7.5.2):
On Windows, Avast Antivirus may interfere with HAXM and cause Android Emulator or QEMU to run very slowly. A workaround is to uncheck "Use nested virtualization where available" in Avast Settings > Troubleshooting.
So open your Avast dashboard > Menu > Settings > Troubleshooting and disable "Enable hardware-assisted virtualization"
Give a higher priority to your emulator's process in the Task Manager:
Locate your emulator's process in the Task Manager > Details tab:
Right-click on it and Set Priority -> Above normal
Sorry that the screenshot is not in English but you got the point, right?
That helped me significantly! I hope it will help you as well.
Also, one thing as per the Release Notes:
On Windows 8, 8.1 and 10, it is recommended to disable Hyper-V from Windows Features in order for the HAXM driver to properly function.
In my case, I didn't have any "Hyper-V" feature on my Windows 8.1 but you probably should try it, just in case. To locate and disable that feature see this article: https://support.bluestacks.com/hc/en-us/articles/115004254383-How-do-I-disable-Hyper-V-on-Windows-
This is probably because incomplete files in your sdk . Sometimes firewall of ur office or somewhere blocks it and hence error message comes saying peer not authenticated I was facing the same problem but after downloading all the files by getting firewall access
My emulator is working properly and much faster than before

Categories

Resources