Visual Studio Android Emulator Black Screen in Apps periodically - android

I'm currently beginning app development using Xamarin with Visual studio in a virtual machine (My actual PC doesn't support android Emulation but the server next door does).
Whenever I have the virtual android device (using Visual Studio Emulator for Android) open and am using or debugging apps I get a black screen for some unknown reason, I can stop this behaviour by clicking where the home back and app manager buttons would be and this returns me to the app.
After reading other questions and responses online I don't believe my issue is similar, many have issues with flat out black screens with no interactivity, whereas my issue is different.
Some specs:
Virtual Machine I am developing in:
Intel xeon E5 2630 v4 2.2Ghz
12 GB dedicated to my machine
Android device:
5" KitKat (4.4) XXHDPI Phone
API Level 19
If anybody knows what could be the cause of this issue and perhaps a solution, it would be greatly appreciated

I contacted Visual Studio Android Emulator Feedback to get an answer to my question, I got a reply saying that Microsoft do not officially support nested VM's as there is no dedicated GPU provided to the system.
However there is a workaround which is disabling OpenGL, I tried this method myself but I find the emulator becomes rather slow and far less responsive. By the way disabling OpenGL is also unsupported.
Disabling OpenGL
In VMWare Fusion, under General settings, for the OS Type, you’ll need to change it from Windows 8.1 to “Hyper-V (unsupported)”. I would also suggest at least 2 processors and 4gb of ram (6gb is better depending on the Android VMs you want to run)
In Windows, you’ll need to edit the c:\program files (x86)\Microsoft XDE\10.0.10240.0\skus\android\xdesku.xml file and remove the following line from the file: GuestDisplayProvider=”VsEmulator.OpenGLGuestDisplay”
Source of Method

Related

Android Emulator laggy even with all optimizations

HAXM Enabled version 7.1.0 and i verified that it's working when the emulator is running
The emulator is using the Nvidia GPU however it's barely using maximum 7% of the GPU at any given time
I have 27.3.1 of Emulator version ( Latest )
Tried x86 image and x86_x64 image
I tried hardware acceleration
I tried software acceleration
I bumped the emulator ram to 4GB (I have 20 GB)
I set the emulator CPU priority to real time
I have NOTHING but Android Studio, and emulator running
The emulator is running horribly slow and laggy and even gives a black screen when going from activity to another
This has been the case since forever
I tried deleting the entire Android SDK and installing from scratch
I have intel virtual technology enabled in BIOS
I tried Google Apis vs none Google Apis emulators
I tried Nexus 5, X, Pixel 1, 2, XL with android P, O, 16 and all laggy
This is what helped me with my Android 9 emulator:
Use Google Play x86 image instead of Google API x86 image, because the former had a notification "Preparing for setup.." which never finished.
After launching the emulator first time, going through the initial google device setting (skipping what can be skipped..) and setting up the SD card (as an external storage).
If there are some app updates running, wait for it and then force quit 'Google play services' app. If the emulator will be slow again after reboot, you might want to do this after every launch.
Disable mobile data in settings, because it was trying to connect again and again, using up all CPU. And CPU helps with rendering, so if there is no available CPU, it gets slow.
Edit:
5. Go to emulator Settings/Advanced and set OpenGL ES rendered to Desktop native OpenGL and OpenGl ES API level to Renderer maximum and reboot the emulator. In my case, using autoselect/autodetect had far worse performance.
-- this is a follow up for my comment above (it's too long to be written as a comment) --
then we established that the problem is coming from your compute (or your OS) - If you're using a Laptop make sure to check the settings of the laptop performance when plugged and when you're using a batterie. In case you have a desktop check also the settings if there is some sort of limitation set by the OS. That can happen to avoid overhitting and loud fan noises. If any of the above doesn't work and you still really wanna figure this problem out and I'll assume you're using Windows 10, then install Ubuntu or any other Linux distribution as a second OS just to try things out. If The problem is solved then you definitely need to change some settings in your windows.
For anyone looking for an answer. I simply updated windows 10 to a newer version and update my graphics card drivers and the emulator is insanely fast again.
I had the same issue on my laptop and also on my high-end PC. I tried everything I could find on the internet:
updating HAXM to the latest version (in SDK Manager)
disabling Hyper-V on Windows
disabling audio in emulator
disabling multi-core feature
changing the renderer
disabling snapshots [1]
Now, I cannot be 100 % sure that anything from above could not somehow contribute to fixing the issue (even that I changed most of it back), but the issue disappeared immediately after I did this:
Go to SDK Manager -> Install the latest SDK Platform
There is said in Android Developers User Guide [1] that these are the requirements for Graphics Acceleration:
SDK Tools: Latest release recommended (version 17 minimum)
SDK Platform: Latest release recommended (Android 4.0.3, Revision 3, minimum)
Even that I did have SDK Platform version 27, for some reason I believe that HW acceleration was not working, cause even moving the emulator windows was laggy (or even its settings). As I said before, latest SDK Platform version seems to be the thing that fixed it.
Also, do not forget to kill all emulator processes and also Android Studio. But maybe restart the whole computer just to be sure (I was doing it a lot, cause I was also checking a bios virtualization settings few times).
If it won't work for you, try turn off the snapshots as that was the last before I tried this. You will have to wipe the data from that image, or even better - create a new AVD and download the latest image from "Recommended" tab.
Hope this will be helpful to someone as I did spend several frustrating hours fixing it (after few months of living with it).
Disabling mobile data is one way that works if you're not connected already to data (regardless of wifi connection), another debugging tool that could help you is the FPS Meter in the Debugging Options in Android, relevant github guide
If your emulator is SUDDENLY slow, this might be the reason:
I ran through the same issue.
I then realized that it was a picture quality issue.
So if you're using a lot of pictures in your app, it will run slow unless you 'lower the picture quality'.
You can use http://compressimage.toolur.com/ to reduce your image quality.

AVD emulator stuck on logo

I have been using Eclipse and then Android Studio to develop a small app and it all (including the emulator) seemed to go reasonably well, until downloading the latest updates for Android Studio.
Now when I try to run the AVD emulator it gets stuck on the android logo and continually refreshes the screen with a white flash, which looks like it is in synch with the logo refreshing, but doesn't get any further.
I have tried numerous different combinations of device, API, resolution, wiping data, running the emulator from the command line, RAM et. al. for the emulator and different resolutions and refresh rates on my Windows 2008 R2 workstation but nothing works. Can anybody suggest where next to look?
Android studio requires a good integration of hardware as well as OS to run properly running emulator see how munch RAM does it takes run emulator during installation of emulator and use a low quality of emulator first because both android studio and emulator requires different memory space. Coming to the OS and studio works better on UBUNTU, LINUX etc instead on windows and using and if u don't have enough RAM u can use pend-drive as ReadyBoost.

Why does Genymotion insist upon OpenGL support when Virtual Box doesn't, and how to work around?

I am aware of Genymotion openGL error stack overflow question.
I am attempting to run Genymotion on a Windows 10 system, but the graphics adapter is Intel G45/G43 Express Chipset WDDM1.1 and the driver supplied does not support OpenGL and Intel appear to have no interest in delivering a driver that does for Windows 10. I understand that officially this combination is not supported.
But here's the thing: I can start a Genymotion VM fine from Virtual Box, and it appears to work (almost) perfectly, as far as I can tell.
Certainly I don't see any problem with the graphics.
This must be using some (probably Virtual Box provided) software implementation of OpenGL.
However, when I try to start the same phone VM from the Genymotion console, or from the Genymotion button inside Android Studio, I get the error dialog-box in the linked question above.
My question is: Why is Genymotion insisting that there is OpenGL support from the real physical display driver? And of course, if its for a quality reason only (ie: sub-optimal user experience otherwise) is there any way to disable this check?
The reason this matters is that Android Studio does not list the Virtual Box started phone VM as somewhere an application can be run upon. I suspect that when Genymotion runs a phone VM, they set up something that the Android Studio integration needs, that simply running from Virtual Box doesn't provide.
In addition, I can't circumvent the Android Studio integration by deploying to a phone VM using the gmtool device install file.apk command bundled with Genymotion because this is a paid license feature. As you can imagine I am somewhat reluctant to purchase such a license when I know I am running in an unsupported configuration.
Purchasing new hardware also isn't an option for me in the short term.
EDIT: The justification for this question has since evaporated. Although I can't deploy using Android Studio or gmtool.exe, I have managed to deploy by using the phone web browser to fetch the .apk file. The gotcha here is that the web server must supply a Content-Length header or the download will fail. So I now have a workable solution.
{{{ Andy
I'm part of the Genymotion team. That's an interesting question. The answer is: yes, we ask for OpenGL drivers for performance reasons. Without this, the whole Android rendering would be handle by the CPU (as soft rendering) which is not fast enough to allow a real usage of the devices, with a seamless user experience, particularly since 4.3. If you run a 4.2.2 image from VirtualBox, you'll see the UI inside the window but the rendering will be very laggy.
As you maybe already noticed, running the Genymotion devices from VirtualBox works only for images up to 4.2.2 (released 3 years ago). The other image will show only a console window. And to be honest, you should more consider it as a side effect than a real feature. This behaviour could disappear on a future release for any reason. And there is no way to disable this check.
As you mentioned, this configuration is really weird and exceptional. As far as I know, we don't plan to support these kind of configuration and I don't see any real viable solution to make it work properly.
Also, to explain the problem you encountered with Android Studio. When a Genymotion device start, it gets a local IP. This IP can be used to connect it to adb. Then it is possible to interact with the device like with any other Android device. This is the tools used by your IDE (and (m)any other tools communicating with Android devices.
Usually, the Genymotion app does this for you, by connecting the newly started device to adb. But you can do it yourself by running adb connect <DEVICE_IP>:5555. Just be careful because this connection could not be permanent and you should have to run this command regularly in some situations.
I hope this answer will help.
Cheers.

Is it possible to run android application without emulator and android phone

I am using Android Studio, my system does not support emulator and I don't have any android phone but I want run android application. Is it possible to run android application without emulator and android phone?
You will always need to deploy your applications on Android OS which is only possible on an emulator or Android-phone when developping native-apps. If you're developing hybride applications, you can run your app in a browser and use browser-plugins to simulate the native features of your device. Please keep in mind that there is more than 1 emulator available for Android. The emulator in Android Studio is one of the slowest available. Try using genymotion or BlueStacks, but preferably, Genymotion.
There are different emulators. You can try installing Genymotion. You need an emulator or an android phone to run your app
No. It does not make sense that you would be able to do so, every application for any device needs a platform to run on!
More importantly, why do you say your system does not support emulators? There are many free emulators available online, I personally recommend you try Genymotion.
UPDATE: My guess is that the error you are getting is due to your computer hardware not supporting multiple CPUs such as those found in modern android phones. It might be possible to turn on hardware virtualization in your computer BIOS (usually you press F2 or some such when you are booting up - but this depends on your particular hardware).
The very first thing I would try before anything else is to download Genymotion (as it was also recommended by the other answers), and at least one other emulator before giving up. Have you tried any other emulator other than the default one that comes with Android Studio? Different emulators likely work differently and they might not need hardware virtualization.
If you are unable to use the HAXM based emulator or Genymotion, you are better off buying a handset device.
Otherwise you are limited to running the ARM based emulation which in the SDK manager looks like 'ARM EABI v7a System Image'. The ARM based emulation should be used with GPU acceleration enabled. Best possible performance would be to use the smallest screen possible such as 480x320, 800x480 or 854x480. The larger the screen in terms of pixels, the worse the performance.
Again the best recommendation is to get a Android phone/tablet and do your development there.

IntelliJ Idea - Android Virtual Device doesn't start

I'm using IntelliJ Idea 13 to develop Android applications on Ubuntu 12.04 64-bit. But my virtual device never starts despite there is no error.. its screen always stays like this:
My Android target level is 4.4 (API 19). How can I solve this issue?
Edit: Here is my AVD details:
I Recommend you look at this post to a similar question.
https://stackoverflow.com/a/5535532/2978914
they are using eclipse but you should be able to view the logcat, other posts say first load can be ridiculously long.
the spec of your PC may come into play as this post https://superuser.com/a/347298 explains the way the emulator converts to arm opcode: direct quote:
To use emulator more effectively, this is my experience:
Don't close emulator everytime you run your application.
Scale the emulator screen smaller.
Disable snapshot (Yes, it's useful but it takes time to close the emulator).
Specify a file path for SD card image file. I use only one SD card for many AVDs.
If you got any problems in adb, just reset adb, don't close emulator.
Open few programs in your operating sytem.
If you are using Windows, don't ever close emulator. Do it combined with Hibernate of Windows.
My AVD has started after I check "Use Host GPU" option from "Emulation Options".

Categories

Resources