Why is my Android Emulator appearing and disappearing? - android-studio

I'm learning to use Android Studio. I'm following this tutorial (https://developer.android.com/training/basics/firstapp/running-app)
I'm running into an issue where my AVD appears and then immediately disappears. Initially, the AVD indicates that it is "Resetting for Cold Boot Emulator Engine Failed." I stop seeing this issue when I edit the AVD Manager to use Cold Boot instead of Quick Boot.
Now, the AVD appears and does not indicate any error. It just crashes. Is there something that I'm missing?
Additionally, I remember that when I first tried to open up a AVD, there was an alert saying that Riot Vanguard is incompatible with Android Studio. I've since deleted Riot Vanguard, rebooted my machine, and reinstalled Android Studio; Still no luck.

Try deleting the AVD and reinstalling if that doesn't work check for updates in
Tools -> SDK Manager -> SDK Tools -> In that look for Android emulator and see whether there's an update

Related

How to run Android Studio emulator on M1 Mac?

I'm having a devil of a time using the Android Emulator on my new M1 Mac. My Android project compiles fine, and I can run it on a hardware device. But I'm not able to run it on the Emulator.
I followed instructions carefully, and set up an arm64-based emulator running API 31. When I press the "Run" button in Android Studio, the emulator opens and boots normally. However, Android Studio is never able to launch my app on it. I see a message "Waiting for all target devices to come online", and that's it.
I have of course tried restarting the emulator, restarting Android Studio, rebooting my computer, and wiping the data from the emulator. I have also made sure that Developer mode is enabled in the emulated Android environment and "USB Debugging" is turned on.
Another suggestion I saw was to un-check "Enable ADB Integration" in Android Studio. This option doesn't exist in my copy of Android Studio, although I did some further research and found that it is now called "Use libusb backend" instead. It is unchecked by default. I tried checking it anyway, and that didn't help.
I'm at a loss as to what to do next. I really need to be able to test my app in the emulator as my inventory of physical devices is fairly limited.
Thanks,
Frank
Download Android Studio Preview, create emulator (API 30 or S), now you can use emulator on both preview or stable Android Studio.

App in Android Virtual Device continues to stop working

Extra context: using LibGDX engine in android studio. Updated android studio today and avd no longer works.
After I build my project and run the AVD the app crashes. I have gone into settings and tried to open the app from there which occasionally opens up the app and then promptly crashes (and the screen will pop up with a message that says the app keeps stopping - screenshot attached). Additionally, I get this error: Emulator: Started GRPC server at 127.0.0.1:8554 - which I have checked through the following stackoverflow links but have struggled to fix the issue still. I have searched through stack overflow and have tried:
cleaning the project and rebuilding it
restarting android studio and then rerunning the code
restarting the avd
creating a new avd
updating SDK tools (though I am uncertain if I have the right tools installed, will attach image of what I have installed)
updating android studio (running version 3.6.1)
invalidating caches and restarting (after deleting the app off of the emulator, and after reinstalling
the app on the emulator)
For context, I was looking at these stack overflow posts and have tried the suggestions that I mentioned
above, but I could have missed something:
Android Studio cannot find cerfile, emulator doesn´t start
Why do I get this GRPC Error "WARNING: EmulatorService.cpp:448: Cannot find certfile" when I start the emulator?
GRPC Server error while running andoid app on emulator
Error type 3 Error: Activity class {} does not exist
Any help would be appreciated, and I would be happy to edit and provide more information if needed!
This is the snapshot of the error in the AVD mentioned above.
This is a link to the picture of the SDK tools installed on my computer.
SDK Tools installed
Edit:
I tried a new android studio project without LibGDX and the AVD worked fine.
I've followed this video for the setup of my LibGDX project: https://l.messenger.com/l.php?u=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp_hp6vMeewQ%26list%3DPL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl%26index%3D70&h=AT2_tH6gq08lg9Xnl0q0C6DJ5bnjySsbAvu0KmR9Jr6m8g8xGLzK5k39bMl5jdpQgFYHQcnd6t_rqixKPG6pTO1gYzPoBMN1MC_qzF8jUqtQITrsA-gU46c9zLHt90nZY8_ACbeRK33DmDvfGGQrYA
I've followed this video series for the tutorial I am working on - the AVD broke on this video: https://l.messenger.com/l.php?u=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dp_hp6vMeewQ%26list%3DPL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl%26index%3D70&h=AT2_tH6gq08lg9Xnl0q0C6DJ5bnjySsbAvu0KmR9Jr6m8g8xGLzK5k39bMl5jdpQgFYHQcnd6t_rqixKPG6pTO1gYzPoBMN1MC_qzF8jUqtQITrsA-gU46c9zLHt90nZY8_ACbeRK33DmDvfGGQrYA
So the links I posted and what I tried (cleaning the project, deleting the app from the emulator and invalidating caches and restarting android studio) actually do work.
The problem was that android studio did not understand my .tmx file (the file that will provide the map for my app) for some reason.
I realized this after clicking on the tmx file, as android studio displayed a prompt about downloading dependencies for the tmx file. Then all I did was download the suggested dependencies and then cleaned, deleted and invalidated/restarted and the AVD worked.

android studio emulator not selectable

I want to start coding with flutter, so i decided to download android studio.I created an avd called "Pixel 2 API 28" with android pie. When i want to select the pixel 2 as the avd device, the programme tells me that theres no avd, but on the right i can see the avd i created. When i put my cursor on it, it says "not applicable for the main.dart configuration". i have HAXM installed and Hyper-V is disabled, but i also tried it with both being active. I used the default code, which appears when you launch android studio.
Please help!!!
Edit:
I somehow managed to select it now, but i get this error: Running multiple emulators with the same AVD is an experimental feature. Please use -read-only flag to enable this feature.
Try starting the emulator from avd and then check if the device is showing up there if not try running
flutter devices
If the device shows there you can try running
flutter run -d <your-device-name>
You can also check whether the android sdk is configured with flutter try running
flutter config --android-sdk /path/andriod/sdk
hope it helps
Close Android Studio and Run again as Administrator
This is Only the solution i got after working hard for 3 days.

Android studio no longer detecting device after update

A few hours ago, my Android studio was working very fine. I could write, build and run on my test device (TECNO K7).
I decided to update my Android Studio to 3.5. The whole process went well except that I cannot find my device among the list of devices any longer. I have also tried with multiple devices, I got the same outcome. When I click on the run-button, the app runs on the Pixel 2 emulator. However, I want it to run on my device.
Here's a screenshot of what my menu looks like. Note that the device (TECNO K7) is currently connected:
Is there something I am doing wrong?
UPDATE:
I tried restarting my ADB server and I go the following error:
Unable to locate ADB.
I have also tried re-installing the following tools multiple times, still the same outcome:
Android SDK tools
Android SDK Build-Tools
Android SDK Platform-Tools
PS: For reference, I use Mac OS and it is also important to remember that my Android studio was working perfectly fine before the update.
Solution:
Drivers not installed: If the Android Physical device is not a Google/Nexus product than you have to download the OEM drivers of the particular model.
HAXM not installed properly : Hardware Accelerated Execution Manager must have not installed properly on your computer. Try reinstalling it directly from the options available in your SDK.
No proper Path : Sometimes though the files are available in the local system, The Android Studio is not guided with the accurate path name to reach the file.
Hope this will be useful to you.
After spending hours on this I found that the Studio update had un-assigned an SDK for my project.
Selecting File -> Project Structure, then selecting an SDK under 'Project SDK' immediately displayed the 'allow debug on this device' dialog on my phone, then within a few seconds after accepting it, the device showed up in the device list.
Go to:
File > Invalidate caches/Restart > Invalidate and Restart
That should work.
Before going to bellow steps make sure
Your "Google USB Driver" package is installed ("Tools" -> "SDK Manager" -> Check "Google USB Driver" -> "Apply" -> "Ok").
If you are trying to access with emulator then check "Intel x86 Emulator Accelarator(HAXM installer)" is instaled. ("Tools" -> "SDK Manager" -> Check "Intel x86 Emulator Accelarator(HAXM installer)"" -> "Apply" -> "Ok")
Go to Tools.
Then go to SDK Manager.
Open SDK tools.
Uncheck "Android SDK Platform-Tools" (On my case it was checked).
press apply then ok.
Again goto Tools.
Then goto SDK Manager.
Open SDK tools.
check "Android SDK Platform-Tools"
Restart Android Studio :)
Hope this will help somebody like me.
This option is definitely not the most optimal. I eventually deduced that the problem was with my HAXM and simply re-installing this would have solved the problem. If you face, this exact problem, simple re-install the HAXM in your SDK.
I hope this helps someone out there.

emulator not showing up on android studio

I've searched all over the web for the past 3 days and can't seem to find a solution. I've done everything mentioned in this post:
Android emulator not showing in Visual Studio
It seems all the 'working' solutions to this problem has been stated in what this guy says he did in his original post, including restarting ADB server (kill and start), restarting my computer, reinstalling emulator and HAMX, installing and running as an admin, changing the timeout delay, reinstalling almost everything, making sure my emulator is installed, etc.
It keeps saying Gradle build finished in 475ms, etc and then waiting for target device to come online for like 5-10 minutes and nothing happens. No emulator shows up. I can't seem to find the solution to this and I am on the verge of giving up, I really need Android Studio to work so I can start on my app.
Can I please get some guidance with this?
If it's relevant, I'm using a Mac.
Have you tried this. Go to the emulator settings and set the Graphics Emulation mode to Software GLES. The default mode will be automatic. I am not sure how it works, but that worked for me on two Linux machines. Being software emulation, the performance of the emulator will not be as good as when using hardware graphics. It seems to be a bug with the SDK.
For me the only thing that worked in macos was to disable docker before starting Studio.
Wipe the data of your Android virtual Device and then start the emulator.
I was using Android studio 4.2 and faced this issue.
No Solutions worked for me so I just erased android studio files. Updated to Android Studio Arctic Fox.
Link to remove android studio files from mac : How to completely uninstall Android Studio on Mac?
For Windows : How to completely uninstall Android Studio from windows(v10)?

Resources