Android studio: Cant get App to install on emulator - android

So up until today everything was working and after doing some trouble shooting on why my app's code was no longer updating, I uninstalled it from the emulator. Now when I go to run it again, it no longer launches or even displays as existing in my emulator. How do I get it to install on the emulator (again) so that I can continue to develop it further? Thanks guys
The Run Logs: Worked before, nothing unusally here.
C:\Users\Will\AppData\Local\Android\Sdk\tools\emulator.exe -avd x86-L
Hax is enabled
Hax ram_size 0x20000000
HAX is working and emulator runs in fast virt mode.
audio: Failed to create voice `goldfish_audio_in'
qemu-system-i386.exe: warning: opening audio input failed
console on port 5554, ADB on port 5555
Strange thing is that when I read through the Android Monitor it appears to be building the app each time I launch it. but it wont launch/display/install it. not sure how to put it into words sadly.
Any and all suggestions on this matter are welcome. Id love to be able to try different ways to make this work.

It seems that your avd memory is greater than your haxm memory. Set avd memory equal or less than haxm memory. For example if haxm memory is 512mb. Set avd memory equal or less than 512mb.

Using the K3b's way of using ADB an a apk file to manually install the app worked. Missing some core functionality by doing this way since some features dont work now but its a start at least.
adb install {file.apk}

Related

Android emulator not starting window 10 - too many emulator instances

This might seem to be a duplicate of it seems too many emulator instances are running on this machine. Aborting but that question was asked 5 years ago and nothing in the answers to it have helped me. I really think this is a different situation entirely.
I'm doing something very simple. I installed Visual Studio 2019 with Xamarin and the Android emulator.
I try to start the emulator from the command line and I get...
C:\Program Files (x86)\Android\android-sdk\emulator>emulator.EXE -no-boot-anim -avd VisualStudio_android-25_x86_phone -prop monodroid.avdname=VisualStudio_android-25_x86_phone
Windows Hypervisor Platform accelerator is operational
emulator: ERROR: It seems too many emulator instances are running on this machine. Aborting.
If I add the -verbose switch I get a huge list of messages, none of which seem relevant so I haven't included them.
This is what I know:
Windows Hyper Visor and the Platform features are enabled.
There are no other emulators active on the machine. Ports 5554, etc are not used.
HAXM acceleration is not enabled.
I have plenty of memory and disk on this machine and the emulator is configured for 512MB of memory
Genymotion emulators are not an option...I need to use Hyper V.
Windows version 10.0.17763.678
All patches to Android tools installed.
No special AV installed. Using Windows Defender.
Tried disabling firewall briefly. No help. I've never had any issue with firewall and local machine traffic.
Any ideas?
Ok...I got the emulator running. I'm really not sure what was wrong. I've spent a few days uninstalling, reinstalling, updating and finally the thing is running. To anyone else who has this issue...I feel your pain.
Here are some suggestions:
Get the code running on an actual physical phone. This worked straight away for me. This gave me some confidence that there was nothing wrong with the code or deployment.
Install and run the emulator on another dev box. Again this worked straight away. This gave me confidence there was nothing wrong with the dev box configuration that inherently prevented the emulator from running. Now I could put dev boxes side by side and investigate the divergent behavior. Did not discover any smoking guns this way, but again it built confidence.
Start the emulator directly from the command line using something like this...
c:\Program Files (x86)\Android\android-sdk\emulator>emulator -partition-size 512 -no-boot-anim -verbose -feature WindowsHypervisorPlatform -avd Android_Accelerated_x86_Nougat -prop monodroid.avdname=Android_Accelerated_x86_Nougat
Reboot/restart often. What I failed to detail in my original post is that I am using Xamarin. Long time users of Xamarin know that this stuff is really brittle. It has gotten a lot better in recent years, but this latest experience shows that it is still very tempermental and problems often disappear after restarting VS or rebooting your machine. Really demoralizing.
Good luck!
I have faced the same problem, i disabled the application control from the antivirus software i use and the problem solved the emulator started working properly.The port that the emulator uses is restricted by the application control feature that is enabled in antivirus software so try disabling it and relaunch the emulator.
I turned off Bluetooth in Windows 10 notification area and that helped me.
https://i.stack.imgur.com/7Qo1t.png
I just solved this by turning off windows hypervisor platform in turn windows features on off and restart your computer. When emulator works normally turn on it again.
Happy coding!

USB device exceeds power limits

OK, the android studio really drive me crazy.
At first, AVD cannot launch and I have post my issue here to AVD not running and failed to create new virtual device Throwable: Failed to create the SD card
After install Android SDK Tool from sdk manager and HAXM installer, it finally can lunch but emulator cannot start up.
After I increase the emulator memory, my emulator works fine but I cannot use real device to run my project.
Error: Power Surge On Hub Port: A USB device has exceeded the power
limits of its hub port
I'm not sure whether the error exists is due to the emulator setting because it can run before the emulator memory get increased. Anyone can help? It totally frustrating.
Try restart your system. I faced the same issue before, but it solved after I restart my system.
This happened because I select TB in emulator setting. After change to MB and restart the system again, it solved

it seems too many emulator instances are running on this machine. Aborting

When I run it from the SDK manager, the loading process works, but once it is done, a flash of the emulator appears then quickly disappears.
Sometimes after it loads, nothing happens.
At the worst when it loads, I get the "too many emulator instances are running on this machine. Aborting" message.
I want to start making apps, but this seems to be the only thing stopping me!
I had already turned off Windows Firewall.
pl'z, give me solution
Eclipse Indigo; r12, Windows 7 (64)
The Android emulator uses loopback ports (5554, 5556, etc) to communicate with the external ADB. If it can't do so, it assumes that other emulator instances are occupying these ports.
Failure to do so can be because:
A) Your ports are occupied? Try netstat -an | grep 5554
B) Your loopback interface is not configured - You said you're on Windows - Make sure Windows Loopback is configured (try pinging yourself). (On Linux the same would be achieved by "ifconfig lo", and see. It should be configured, with the right IP (127.0.0.1) and up.
Incidentally, it's MUCH easier to use Android SDK on Linux, because that way both target and host are Linux. Consider running the whole thing in a VM image - and your SDK Experience will be immeasurably easier. From experience.
I also had an error problem ERROR | It seems too many emulator instances are running on this machine. Aborting. in the emulator windows command.
I had a lot of virtual networks, all of which were active, because of the VirtualBox and vmware installation.
Solution: Disabling all those networks solved my problem.
For me, the reason is that I was using wsl-based docker on Windows.
Try disabling the option Use the WSL based engine in the docker settings (which resorts to using Hyper-V)
Enable Hyper-V in Windows Features.
Restart your computer and you should see it work like a charm.
My virtualbox VM, android emulator and docker now works together!
I have Hyper-V enabled (Intel CPU) for use with Docker and WSL2, on Windows 10 21H1.
Returning to Android programming after a hiatus, I reinstalled Android Studio today (4.2). It tried and failed to install HAXM (which is not surprising as it won't work with Hyper-V). I then was unable to open Android virtual devices.
After hunting around for answers (mostly people saying to disable Hyper-V which I was not ready to give up on), I found the exact process command line for the emulator and ran it in an admin window for good measure. Enter the "it seems too many emulator instances are running on this machine" error, previously invisible, which led me here. I checked ports and shouted into the void - nothing helped.
Then I rebooted, on the off chance something in all those attempts was somehow still holding resources (despite killing every related process).
The Android virtual device worked after that reboot, with Hyper-V still active. I hadn't changed anything that should have required a reboot, but evidently some resource(s) were locked along the way in my previous session.
(Also note that if you don't touch/edit \qemu.conf on whatever drive you run from (typically C:) you will see the incorrect Your emulator is out of date error if running from the command line.)
Just enable Hyper-V from Windows features

emulator-x86.exe has stopped working

I am getting these error at console.
hax is not working and emulator runs in emulation mode eclipse.
So I am unable to run the app in emulator.
After spending a lot of time,I am come up with the answer.
If you are getting emulator-x86.exe has stopped working Error means:
Try these two steps:
Change the resolution of the device 1280X800 to 800X600.
Reduce the size of the Ram by 512 MB or less.
If you are getting Hax is not working Error means:
Try these three steps:
1.Hax software would be located
in
C:\Program
Files\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager
Install the HAXM Driver by running "IntelHaxm.exe" in command Prompt.
2.. if the installer fails with message that Intel VT must be turned on,
you need to enable this in BIOS.
For Eg:
if You are using windows 7, press F12 key to enter into bios setting.
There you can see the Intel Virtualization Technology placed in System Performance.Turn it on as enabled
3.Then again run the "IntelHaxm.exe" in command Prompt.Everything will be works fine.
In Android Studio, AVD Manager, edit the AVD you want and disable Use Host GPU under Emulated Performance. This eliminated this problem for me.
In my case, I solved this by un-selecting Multi-Core CPU.

Why does Android Debug Bridge (adb) have to be restarted frequently?

This is what happens about half a dozen times every day:
An Android emulator (e.g. CPU/API: Intel Atom (x86), Target: API level 15) works fine for a little while, then Eclipse shows the following error when an app is installed
[2013-07-01 15:15:47 - Myapp] Failed to install myapp.apk on device 'emulator-5554': Connection refused: connect
[2013-07-01 15:15:47 - Myapp] java.net.ConnectException: Connection refused: connect
[2013-07-01 15:15:47 - Myapp] Launch canceled!
Sometimes closing and restarting the emulator will remedy this. However, most of the times, starting an emulator generates the following:
[2013-07-01 15:16:43 - Emulator] HAX is working and emulator runs in fast virt mode
[2013-07-01 15:16:43 - Emulator] emulator: warning: opening audio input failed
When this happens, the emulator will show up, but it will not work (i.e. apps cannot be installed). Resetting adb (DDMS > Device > Reset adb) will not work. I have to go to Windows Task Manager to kill adb.exe. Adb.exe will be restarted automatically in less than 20 seconds, and everything will be fine.
I am a bit sick of doing this many times every day, so I am seeking a way to avoid adb corruption.
Computer OS: Windows 8 Pro
CPU: Intel i5
Eclipse: Build id: 20121004-1855
Added on 2013-07-26:
I selected IronBlossom's response as the answer even though it does not answer this question specifically, but it solved the problem of having to restart ADB frequently. Actually, it solved multiple problems including a very significant one - unable to run Intel's Android emulators in fast mode and Windows Emulators simultaneously. There is a trick to run Genymotion emulators and Windows Phone emulators side by side.
Try using Genymotion . It runs on Oracle VM .
It even has GPS and Battery level features, comes pre-rooted with Superuser app.
I usually work with 2 computers, one is a High end computer playing windows 8 which I never got adb crashing or emulator running slow, but on my macmini with an i5 2415m and 2GB ram it crash a lot, but after I upgraded it to 5GB ram adb rarely get crashed, I can run 2 eclipses and 4 emulators and it rarely crashs.
So what I mean, is that maybe adb is not finished and it has some issues which may be related to memory leaks or thread synchronization, But (again but) it is just a shot on my experience, actually it never bothered me much.
When you hit a runtime error on device, instead of ctrl+c'ing out of adb, first click the prompt on the device acknowledging the crash has occurred. After that then ctrl+c out of adb. If it worked this should print out something happy.
adb devices

Categories

Resources