Android studio - avd crashes - android

i'm using android studio in windows server 2016 and have next problem: for work task i need to start android device emulation. On windows 10 emulator works fine, but same steps on windows server cause problem -"the emulator process for AVD_Pixel3A was killed". What should i do?
p.s: hyper-V components not installed, virtualization is accessable.

You will need to to have the H-visuals turned on.. Also check to see that you have HAX installed. Also be sure to turn on developer mode within the computer... I would also run the program on a physical android device to see if you get the same issue.
Also if none of these work you might have to check to see if the server runs the minimum requirements. If it does you may have to reinstall Android Studio. I had this happened to me the other day. I uninstalled and reinstalled Android Studio and it fixed the issue.

Related

Android Studio: Running application in emulator not working

Today I downloaded Android Studio for my Debian Testing system. I wanted to run a HelloWorld application but weren't able to run it. With adb I can install it without having any problems.
However, if I try to do it with Android Studio, it gets stuck on 'Installing APKs'. The same happens when I try to start it in an emulator (gets stuck on 'Waiting for target device to come online').
My device is a Samsung Galaxy S3 with LineageOS (Android 7.1.2) and root permissions. Android Studio recognizes my phone properly.
What I've already done:
installed openjdk
set android_home
installed all the SDK-platforms since Android 4.3 and Android Emulator from SDK tools
enabled USB-debugging
tried with MTP and PTP
tried another emulated phone
installed lib32stdc++6
restarted my computer
and probably much more
I tried to do it the whole evening and couldn't find a solution. Is there something Debian-specific because I can only find instructions for Ubuntu? I have never experienced anything close to this on other systems.
Thank you in advance.
EDIT: I am now able to use my phone to run the android application by using USB 2.0 instead of USB 3.0! Is that a normal behavior since it works with native adb? I mean, if I buy a new PC after some years which has got only USB 3.0 ports, will I not be able to use phone debugging with Android Studio or is this just an issue? It is still known since 2014 (https://stackoverflow.com/a/9548311/8292104).
However, I still cannot get the app running on an AVD. I changed graphics to software, now it shows the phone but the screen remains black and the phone won't start. What can I do to fix it?
Try to completely delete and install Android Studio again, I think that it will solve the problem
Another possible solution that worked for me is to, in the application, go to
app - build - intermediates - split-apk - debug - slices
and then delete all of the contents within this folder. Then again, this only worked for me, so I would duplicate the document in case of corruption.

After android studio update api 24 emulator showing offline

I am using a MACbook. For one specific emulator its always showing offline. The emulator has a nexus 5 skin and is a api 24 build. When i try another emulator its fine and works. i tried re-creating the emulator. when i run adb devices it says the "unauthorized".
I tried the following:
I went into the developer settings of the emulator and allowed usb debugging if to see if that would help but it did not. this happened after i updated android studio to 2.3. i also tried to wipe user data from emulator. What is going on here ?
UPDATE: THIS IS OCCURRing for my other emualtors above api 22 also . i had to switch to genymotion for now which seems to work fine and shows as online. it has something to do with updating android studio. after i re-installed studio and did not take the 2.3 update, the problem was resolved.
Don't know the exact issue but it appears there are some bugs/issues with the latest updates.
Personally I am seeing my tests fail when run by ./gradlew commands, but not when run via Android Studio IDE.
I experienced your offline issue as well, I found I could at least rectify this by running:
adb kill-server
adb devices
More info on this in another post:
https://stackoverflow.com/a/21330228/5096103
-- UPDATE --
After investigating this one a little more, I found there to be compatibility issues between Qt version 5.7.0 which the new emulator uses, and Ubuntu 14.04 and it's version of Qt. Whatever system you will be using, you will have some version of Qt installed.
I'm guessing this may be the cause/related to the issues you are experiencing.
I was successfully able to fix my system by downgrading the SDK tools from version 25.3.1 to 25.2.3. I don't get the speed improvements of the new emulator, but at least I can run my tests reliably.
Going to try resolve the issues between Qt versions, and will update this if I can get the new emulator to work correctly again.
I had the same problem. I solved it by turning on USB debugging after unlocking developer options of the emulator by clicking 7x on the build number.

Error while waiting for device: Timed out after 300seconds waiting for emulator to come online

I have been trying to use android studio emulator but I can not run my App on the Emulator. When I Run my App it shows the emulator with following details:
Hax is enabled
Hax ram_size 0x40000000
HAX is working and emulator runs in fast virt mode.
Console on port 5554; ADB on port 5555
After that it takes to next TAB Launching app and shows waiting for the device to come online. After that it shows error:
Error while waiting for device: Time out after 300 seconds waiting for emulator to come online.
Anyone know any solution.
Although there could be various reasons for this behaviour....
Mostly it may be due to error in system images or the API version you are using
better you download latest system images and make sure the compatibilty of API version you are using.
If problem exists
I would like to suggest some fixes:
Try them
1)Uninstall/Reinstall Android SDK to folder.
OR
2) delete the emulator and create another emulator targeted at the appropriate API Level.
OR
3)create a new Virtual Device.
OR
4)set "Max VM application heap size" hardware property to 192 or higher and pick the QVGA skin.
hope it helps.
I was also facing this timeout error. Here is the solution worked for me
Launch Task Manager -> Search for adb.exe in process list->End the process->Try relaunching the emulator it will start.
This helped me:
https://www.youtube.com/watch?v=avcOIrtimMU
Click on app: edit configurations;
In Launch Options: choose Specific Activity
In Activity: specify your main class: com.example.budgetapp.MainActivity
And, run.
This Worked for me:
GoTo SDK Manager -> SDK Tools -> Check that the android emulator has the latest version and If doesn't install the updates.
I had the same error described here.
Hope This Helps
Check updates.... Emulator had an update.
After I updated worked fine.
I went through a lot of posts. But none of them seemed to work for me. Every time I tried to start the emulator, the process seemed to be "not responding" after a minute or so. I tried restarting my PC, adb, created new devices, even re-installed Android Emulator, but nothing worked.
Surprisingly enough, what worked though was to move the emulator out of Android Studio.
Go to Preferences -> search for Emulator -> Uncheck Launch in a tool window
I am using Mac M1 Pro with Android Studio Bumblebee | 2021.1.1
Open the AVD Manager.
Create a new AVD or edit an existing AVD.
In the Verify Configuration page, specify the Emulated Performance: Graphics change to sofware or hadware
good luck
I tried everything here and other questions too, but the only solution for me was to create a new AVD.
Also downgraded from Pixel3XL to Pixel2, not sure if it matters. (Kept same android version)

Visual Studio emulator for Android stuck at "OS is starting...", only on API Level 23 / Android 6

Since I read the news about Xamarin now being "free", I immediately installed Visual Studio 2015 Update 2 and the Android tooling (NDKs, SDKs for 19-23, Visual Studio Emulator for Android dated January 2016) to start working on an Android application.
Excited I launched the emulator from Tools -> Visual Studio Emulator for Android and installed the profile that is the best match for my own phone. Since my phone is on Android 6, I decided to get a profile for API Level 23 / Android 6.
Since I had already enabled Hyper-V a few months ago, the installation for the profile only had to add me to the Administrators group and create 2 network adapters.
So far, so good.
Upon starting the emulator, it would stay at "OS is starting...". I figured I'd wait a while. I figured I'd wait a while longer too. After that, I gave up the possibility of it going to work and started investigating.
I also tried other profiles, a few others from API Level 23, one from 22 and one from 19. Only the ones from API Level 23 did not work.
The following steps are what I came up with so far by Googling etc. I tried them in all sorts of combinations:
Rebooting
Disabling / enabling Hyper-V
Removing vEthernet adapters (through the Hyper-V Manager).
Running XDECleanup
Allowing XDE through my Windows Firewall as application (incoming)
Restoring the emulator software in Programs and Features
Enabling / disabling "Processor Compatibility" in Hyper-V Manager.
This is the data I've gathered so far:
A screenshot of the error message that the emulator gives after waiting a long time (10 - 15 minutes, maybe a little longer)
A screenshot of the last part of the log when being connected to the Android 6 VM:
A screenshot of the last part of the log of a working VM (this one's from an Android 4.4 VM):
Responses I've got so far from Microsoft:
-Those errors are normal
-And the only step I've tryed which they told me to, and I don't see here, it's this one:
On Hyper-V Manager, check the option for compatibility under CPU section
Besides from this, just make sure that on Hyper-V you get only 2 switches, the one you use to connect to the internet and the one that the VS Emulator for Android creates, I haven't got any results, but if you try, maybe you will.
In my case, I was mucking around with the VS emulator's virtual switches and had the network adapters in the wrong order.
After I moved the Windows Phone Emulator Internal Switch (Created when first running the VS Emulator) to the first Network Adapter slot in my settings, the emulator started up just fine. Apparently, order matters.
Had the same problem but got mine to work after trying a lot of things from different threads.
In the end I think this did the trick for me:
I added "c:\Program Files (x86)\Microsoft XDE\10.0.10586.0\xde.exe" as an exception in the firewall.
(i also switched of the firewall, but was probably unnecessary)
Temporarly disabled the WiFi device
Uninstalled VirtualBox
Removed all Virtual Switches in Hyper-V
Executed XdeCleanup.exe
Started the emulator again and it started up successfully!
Swiched of the emulator and enabled Firewall, Wifi device.
The emulator still starts successfully every time!
Thanks to all for sharing!
If you're using Xamarin, it's recommended that you use Xamarin Player. It's not Xamarin exclusive, it's just a much faster Android emulator. I use Android Studio, and the Xamarin Player is still faster on boot and launch than the default. This is just my recommendation to you, I have no clue how to fix your Visual Studio emulator, sorry.
I've played a lot with this and realized that I have had manually configured paging file on Windows. After restoring it to default all worked perfectly without messing with the virtual switches or adapters.
Just make sure that you have all Windows memory etc. settings set to default.
Regards, Mladen
My problem was that the system image was missing for the emulator.
When I opened the android virtual device manager it had an exclamation mark next to actions(i had to download the system image via the download link).
I had the same error message. The solution for me was:
Uninstall all emulators in the Visual Studio Emulator for Android
Check in Hyper-V-Manager if there also no instances
Unistall Visual Studio Emulator for Android
Run xdecleanup.exe (C:\Program Files (x86)\Microsoft XDE)
Uninstall Hyper-V from Windows features
Removed virtual ethernet adapters through uninstalling in Device Manager
(be sure to display disabled devices too)
Install Hyper-V from Windows features
Install Visual Studo Emulator for Android again
Download and install your emulator/profile
Run the emulator and have fun :-)
It seems there was a problem with the virtual switches and Hyper-V. The correct settings for the adapter looks like these:
Hyper-V-Manager:
Device Manager:
Network adapter:
Ethernet:
vEthernet (Virtueller Switch: Intel(R) Ethernet Connection (2) I219-LM #2):
vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch):
Emulator network settings:

Visual Studio Android Emulator won't run application

I recently got into Xamarin development. I have a lot of experience in Xcode making iOS apps and the iOS side was very straight forward. Now I'm trying to implement Android. I downloaded a Hello World example to get my bearings. When I run it I have no problems getting the simulator to show up (MonoForAndroid_API_10 and MonoForAndroid_API_12) but the actual application doesn't run, and does not show up anywhere on the simulator. Essentially whenever I use run or run with in Xamarin on Android, it pulls up a fully functioning, albeit empty simulator.
How do I get my application to run on the emulator?
Like the other commenters, this is most likely just a symptom of slow emulator on your machine. I'm running Xamarin-Android development on my 2010-era OSX machine in mavericks with 8GB RAM, and it is slow-slow-slow, but usable. Try to find the Intel x86 speeds improvements (look for HAXM) and you will find that the emulator will be much much faster.
And yeah, get a real handset and plug it in to your computer: always much faster than emulation.
later edit Get Genymotion for Mac OSX or for PC/Windows or PC/Linux. It's way way way faster than the other emulators. I have since found that this is as fast, or faster, than running the App on my connected Android phone. It's certainly simpler in not having to have the device plugged into one of my USB ports, and allows me to code and test on the train. http://www.genymotion.com/
Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB.
I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
I've created it manually and it worked.
UPDATE
Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well.
I had the similar issue, and then I deleted the existing device simulator and reinstalled again and it started working.
As I use a different SDK, in my case
Go to Tools > Options > Xamarin and set the Android SDK path.
Sometime Visual Studio changes this configuration;
2020 Update:
I followed the most voted comment, however, with Visual Studio 2019 updated recently, the steps have changed a little. Here is what previously worked:
WHAT WORKED BEFORE
"Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB. I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
I've created it manually and it worked."
WHAT TO DO INSTEAD
Nothing. Don't mess with the path.
WHAT WORKED BEFORE
"Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well."
Previous instructions image
WHAT TO DO INSTEAD
a. Go to Tools located at the top of the VS window, Get Tools and Features, go to Individual components, using the search tool in the pop up box, search "emulator", once you get the result, make sure both Google Android Emulator (API Level 25)(local install) and Intel Hardware Accelerated Execution Manager (HAXM) (local install) are both checked.
b. Close the solution(s) and restart VS then reopen the solution(s).
c. To deploy the app on the emulator, click Start button to spin up the emulator, left click on your Android project, then click Deploy. You should be able to see your app on your emulator's app menu.
Updated Instructions image
Worked for ME
Sometimes you close the android Emulator but not POWEROFF the Emulator.
this problem happens when emulator shutdown un-properly.
Restart Your EMULATOR
First start your emulator
Then restart your emulator by pressing down the power button and select restart option in your android emulator.
I enabled Hyper-V acceleration based on microsoft documentations: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin&pivots=windows#accelerating-with-hyper-v
Basically you need to turn on these two windows features from the control panel (Turn windows features on of off):
Hyper-V.
Windows hypervisor platform.
then from visual studio go to: Tools >> Android >> Android SDK manager >> Tools >> make sure that "Android emulator" version is 27.0.1 or higher, if not, you will find in the same screen a button below to update it.
I did this on windows 10 64-bit, with VS 2017 Community 15.9.5

Categories

Resources