Cannot start Android device emulator on Linux - android

I used to launch and debug Android Studio apps on emulator without problems. However, recently I am constantly failing to start the emulator. Updating the SDK and system images did not solve the problem. Updating qemu-system-* did not help either.
System info: Linux Fedora 25 (x86_64), Android Studio 2.2.3

It turned out that the problem was due to the same old NVidia driver problems with Linux. To fix the crash, I opened AVD Manager from Android Studio (Tools->Android->AVD Manager), and then opened the virtual device settings. Then in the Emulated Performance section, next to Graphics, I selected Software rather than Automatic or Hardware. This does the trick and no more crashes occur for the emulator, though it seems considerably slower, than it used to be when Emulated Performance presumably used Hardware by default. The following screenshots will hopefully give a better hint on the solution.

Have you tried running AVD Manager from a terminal?
Control the Emulator from the Command Line
Here you will probably have more details of the errors that make the emulator not work fine.

Delete in your Android SDK the directory "libstdc++" in the directory "emulator/lib64". The emulator will use the system libraries now.

I was fiddling around on an issue like this on Fedora 32 for a couple of days.
I had to to make system unload the free nouveau graphics driver and install/load the non free nvidia driver.
Very useful:
https://rpmfusion.org/Howto/NVIDIA
To check which driver is loaded I used:
lshw -c video
It is difficult to grab the correct rpm package from rpmfusion.
If nvidia is not loaded, then you can check:
more /var/log/messages | grep nvidia
It told me which driver series to use.
After successful install of nvidia driver, I can use HW graphics option in AVD manager.

Sometimes killing the qemu process and then relaunching AVD solves the problem.
killall qemu-system-x86_64

I know this is an old thread but the answer that helped me is not in this page:
The problem was that my mother board had the parameter "CPU virtualization" disabled. After I turned it on, the emulator started working.

I had this problem and I discovered that I did not have enough memory to run my avds. To check this, it is best to try run the avds through the terminal:
First: Check the avds you have installed by changing directory (cd) to the tools folder under the Sdk folder in the Android folder:
//to cd to the tools directory from your home:
cd Android
cd Sdk
cd tools
Once in the tools folder, check the avds installed:
$ ./emulator -list-avds
To launch an emulator listed under your installed emulators:
$ ./emulator #complete_name_of_avd
If you have enough memory, you should be able to start your started avd successfully. If not due to memory issues, you will get the information through your terminal. Free up enough memory from your device to ensure you are able to run the avd successfully.
Also, you might want to reconsider testing an app from the virtual emulator as it drags the machine so much. A physical device connected via USB will be much better to use. just ensure that you have enabled debugging on that particular device and you will be able to identify it among the list of options you have for deploying your application.

None of above helped me. For versions 2021.* and 2022.* just disable ipv6. I have no idea what if you really need ipv6 but only this action solved the problem for me.
Check your Linux distro manuals for details how to disable ipv6.

Related

Installing apk on emulator in mac

I have followed following tut to install messaging-simulator.apk on my Nexus 7 emulator of adt sdk...
http://www.orhancanceylan.com/installing-and-testing-apk-files-to-the-android-emulator-on-mac/
But, after the device (virtual) is launched (which is annoyingly slow), no further action could be performed from terminal as it gets stuck or no progress is shown. (Basically, I am stuck after ./android command. Nothing can be entered in terminal after that. How do i resolve this?
If you can't type a thing in the terminal - just open a new Terminal window and type it there.
A few tips that will speed up your emulator
Make your emulator as intel x86. and check Use host GPU
Install HAXM from the sdk manager
make the settings like this:
I use mac to develop Android.
Thanks a ton to #Uriel Frankel. Yet, all those tips and tricks given by him did not work out for me due to low memory in my macbook.
So I have used Genymotion emulator(http://techapple.net/2014/05/3-best-android-emulators-for-mac-os-macbook-run-and-install-android-app-on-your-mac-os-x-macbook-airpro/) instead of default android emulator and successfully launched the app by installing it.
You can all try above solution first and if it did not work out, use Genymotion, it's cool :)

How do I fix "Failed to sync vcpu reg" error?

I'm trying to use the Intel HAX x86 emulator for Windows (8, if that matters). I installed everything and created an AVD for the android version, and everything appears correct, but when I run it, I get this output:
Starting emulator for AVD 'x86_QVGA_Level10'
emulator: device fd:1044
HAX is working and emulator runs in fast virt mode
emulator: Failed to sync vcpu reg
emulator: Failed to sync HAX vcpu context
and the emulator won't run. The significant part of this error (Failed to sync vcpu reg) is not mentioned ANYWHERE online, except in the source code for the HAX itself, but I can't figure out how to make any sense of this.
Can anyone advise about how to get past this error? I really need to get this working, because debugging on device and in the default emulators is painfully slow.
Make sure you don't have any virtual machines running. In my case, I had genymotion running which was causing this error.
I had virtualbox running. Killing the VM allowed allowed the emulator to run.
If you are running Docker you would have to take the virtual machine down
docker-machine stop default
This assumes your docker machine is called default. If you want to check the name use
docker-machine ls
A simpler solution; open virtuabox and stop the vm :-)
I had this problem. For me it was the HAXM version.
When you get a new version of HAMX through the SDK Manager, it tells you that it is installed. It is not. You must go to this folder:
<Android SDK>\extras\intel\Hardware_Accelerated_Execution_Manager\
and run intelhaxm-android.exe manually. In my case, I had 1.0.6 and upgraded to 1.1.
I think that what caused the error in the first place was that some other part of the SDK that I had updated needed 1.1.
As mentioned by other answers, make sure no VirtualBox and docker service is running with following command in mac. (systemctl in Linux)
$ launchctl list | grep 'VirtualBox\|docker'
- 0 com.docker.helper
640 0 com.docker.docker.2032
31736 0 org.virtualbox.app.VirtualBox.948
If so, kill the VBox and docker service.
launchctl stop org.virtualbox.app.VirtualBox.948
launchctl stop com.docker.docker.2032
Do you have HP SureClick running? I had the same problem on the HP laptop until I disabled it.
HP SureClick is a security protection program which runs "unsafe" programs in micro-VMs. It may also be called HP Wolf Security on your machine, which is the new name for it, although under the hood (e.g. folders, dialogs etc) it's still called SureClick. It may have some processes visible in Task Manager with a prefix of "Br", which stands for Bromium.
Similarly to other answers, it cannot be running at the same time as Android Emulator, as it is basically a virtual machine.
Here are some steps to disable it (not all may be required but this worked for me):
Right click on "HP SureClick" or "HP Wolf" in your system tray and select "Disable Threat Containment". It will pop up a dialog asking for the reason (optional), so just click OK
Right click on the icon again and select "Disable Malware Protection"
Click Start, type "services", open the Services window and set all "HP SureClick" services to disabled by right-clicking on each -> Properties -> change startup type to Disabled (for me there were 3 such services)
Restart the computer
After doing this, I was able to use Android Emulator again :)
Stop GENYMOTION (open VirtualBox instance if any instance is running, stop it).
Open AndroidStudio -> Run AVD Manager-> run AndroidStudio virtual device.
Latest Android Emulators are not able to run in parallel with GENYMOTION
"vcpu reg" are "Virtual CPU REGisters" that exist on many processors that have things like multiple cores, hyperthreading, or other features that enable higher layers to believe that there is more than one CPU present when there isn't -- such as today's x86s. No reason to go in to detail -- you can imagine that getting a coherent, single "virtual CPU context" is necessary for the kind of hardware virtualization that HAX offers.
Normally, it's not a problem to run multiple virtual machines of various sorts simultaneously. But if one of them crashes, or misbehaves, or just decides to be a hog, HAX might find that it just can't put together a coherent virtual machine, because it can't sync a virtual CPU context for itself. It'd be like trying to run a real machine with no CPU.
Bottom line is open task manager and kill things that you don't need and that look like they might be holding virtual machine resources. In the worst case, a reboot is almost certain to fix the problem.
Quick steps:
Stop all VirtualBox Virtual Machines (i.e. vagrant halt), quit VirtualBox.
All docker-machines should be stopped, too. Quit Docker.
This happened to me also when I was trying to run both VirtualBox and Android emulator in a MacOS machine. As others have mentioned above currently it is not possible to run both (i.e. VirtualBox and X86 -Intel based emulator) in MacOS and not sure about the other platforms.
If we need to run both we can choose ARM based emulator. (arm based emulators are normally slow)
I was getting the same error. I'm guessing there are various reasons for this error, but in my case it was because of a service named ".NCG". The service is Network Content Guard by Inka Entworks, and seems to be some type of DRM solution. Once uninstalled, the emulator worked fine using HAX.
In my case, it turned out this problem was caused by having a webcam selected as "Front Camera" in the settings for the AVD. Setting it to "Emulated" fixed this problem for me.
I faced this issue because I had my virtual box running with Ubuntu on it. When I shut down my virtual box I did not face this issue.
I got the same error on my windows 8 install.
Things you could try:
lower the amount of memory for the emulated device (and/or close other applications)
disable GPU emulation
remove the pass-through webcam
For me, the error occurs when I try to attach a physical webcam to the emulated android instance.
This kept failing until I changed it to [x] Use Host GPU as shown in pic.
I'm running boot2docker vm, just down it solved the issue.
boot2docker down
Make sure you don't have any virtual machines running. In my case, I had genymotion running which was causing this error. when i kill genymotion's Process and kill all Oracle VM VirtualBox related process then it work
by wangshiming
don't thankyou me
Ya, i had virtual box running and was getting this error, shutting it down fixed the error.
I was on a mac and had this problem. I did not think I was running a VM (I have vbox but it isn't running). I restarted my computer and before starting any other apps I tried the emulator and it works fine.
This is the VirtualBox ticket - https://www.virtualbox.org/ticket/14294
Fixed the problem by changing current version of Java within Windows from Java 8 x64 to Java 7 x86.
Yes, VirtualBox VMs have to be stopped. I also had to stop Docker for Mac. The error message only mentions VirtualBox, which confused me a little until I realized Docker for Mac is running xhyve.
If your CPU supports throttling (like Intel's SpeedStep) try to disable that feature in your BIOS. It's kind of a quickfix but at least it worked.
I think it must be a variety of reasons cause this failure. In my case, since I installed the Google input method software, "Failed to sync vcpu reg" appeared. This was the one and only change before normal working. So, after uninstall the Google Input software, it was recovered.just a little reference, although I can't believe this solution for long time either.
I had the Windows Virtual PC running (on Windows of course). Once I turned off, the emulator went fine.
Hope this helps.
I was trying to launch a Gingerbread 2.3.3 x86 emulator and it would not launch. Changing from x86 to arm made the problem go away.
For me, the only thing that worked using adv on MacOs Yosemite, is setting the processor to ARM (native CPU of the device - standard 4" Nexus).
If you are having any virtual machines running, suspend them and try again.
For me the answer was to set Enable keyboard input to true under the advanced settings of the virtual device.
This was the first option I changed on the device, so it is possible that the act of changed an option fixes the error as well based on the wide array of answers above.
Note: I've confirmed previously that no VM's are running.
Finally, I found the anwer for this question.
I had exactly the same problem and it was completely solved.
Virtual device or webcam is rarely the cause of your problem.
Just install mainboard chipset driver.
I recommend you to use 3DP chipset autoinstaller.
Good luck!

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

Eclipse, adb, and ddms not detecting Android Emulator

I wanted to try my hand at programming android devices, so I followed the directions from the android website, installed the sdk, the java sdk, and eclipse. My computer is Windows 7 64-Bit, but I have the 32-bit Java SDK and Eclipse installed since hearing that there are issues with the 64-bit versions.
I am running the most recent version of the Android sdk, 4.0 R15.
I believe followed all of the instructions for installation, but when I load up a sample (Lunar Lander in this case), it loads the emulator, but will not install the app to it. ADB does not show the emulator listed when I use "adb devices", the DDMS perspective in eclipse does not detect any device either. In the emulator I have activated the USB debug setting in the developer area.
I have tried restarting the adb server, and have reinstalled a few times.
I even copied what one guy did on a youtube tutorial for a hello world program, and it still would not load to the device.
Does anybody have any idea how to get the emulator and eclipse talking so I can actually run and debug programs?
Try to adb kill-server and then do adb command like adb devices which will start adb again.
It helps in my case.
Best solution I found is this:
Open DDMS(Window->Open Perspective->DDMS)
In DDMS in the left side there is a Devices tab, a little below there is a list of items, choose little triangle called View Menu, under it find Reset adb and launch it.
After that I get my emulator detected.
Create new AVD following Window->AVD Manager->New (Give a name to your device & select the target) -> Create AVD.
Select the AVD that you created and Click Start to launch the devie.
Only on launching, the device is displayed under adb devices.
For starters, I think you can try the 64 bit versions of Java and Eclipse for Windows. I've Windows 7 64-bit edition, 64-bit java and eclipse versions and all work very well, without any glitches. I however have a question. Where exactly have you installed Android? I mean, using the installer that's available in the Android Developer website. If you've installed it in C:\Program Files, then try re-installing it in C:\ directly instead of Program Files directory. I had faced issues when the directory was C:\Program Files and then I changed it to C:\ .
I noticed that if you allocate a lot of memory to the device it can "freeze" when starting, if frozen for a sufficient period it disappears from the adb devices list. Try reduce the memory footprint of the application?

Categories

Resources