Android Emulator camera hangs after sometime - android

I am developing an android camera app. Whenever i open the app the camera opens normally then after a few seconds most of the times it hangs and ultimately the emulator shows not responding after a while. Very rarely it operates normally when i open the app. Not only my custom camera app but i tested the default emulator camera, it also hangs after a while when it is opened. I don't know what is happening wrong. On real devices my camera works fine. So the issue is not with the app but the camera of my emulator.

It is a bug with certain versions of the emulator. For example, camera app hangs on emulator version 29.3.2.0 (build_id 6083285) regardless of the whether it's emulated or set to Webcam0, but works fine on 29.2.1.0 (build_id 5889189).

I have the same issue but only on one of my laptops. It seems someting is connected with computer graphic card.
Try to change paramather Automatic with Software-GLES 2.0 in AVD manager-emulated perfromance. IT's slower but it works.

Related

Why would a device disconnect every time you use the camera in Android Studio & Flutter?

I've been working on a program in Flutter that opens up a camera, takes a picture, and then uses the picture in the app. I've been connecting my Android tablet through USB tethering to Android Studio to test/run the program. I was able to take the picture with no problems until I started trying to do stuff with the picture, like add it to the app.
As soon as the picture is taken, Android Studio returns "Lost connection to device". It then won't do anything else in the program. According to the Device Selector on the top left of Android Studio, the device is still connected.
I tried running the program multiple times, but it repeats the same issue each time. I also tried it in an emulator, where it worked fine and did not give this issue. I'm not sure what would cause the device to lose connection, even though it's still connected? I'm not even sure what part of the code to check.

mediaprojection : Black screen in some cases

Using "mediaprojection" I was able to capture the current screen from a background service.
The sdk api is 25, Android 7.1.2, and I checked it with an emulator running with BlueStacks without rooting and my mobile phone without rooting.
But when I test it with BlueStacks and another emulator, Nox, I get a black screen.
The same code and only in the Knox emulator without rooting the same code is black screened in the result.
Could the results be different depending on the emulator?
Do you have a "mediaprojection" application running in a background service to test this case?
I have the same problem before but I noticed that bluestacks doesn't allow the use of applications with mediaprojection you can't try in your own device if you want to test apps that can take screenshots or similar situations

Android app built using Xamarin does not show up on emulator

I have written a simple login page using xamarin forms. When I try to deploy it on emulator, the emulator opens but my app is not visible.
1) Does it take time for the app to be deployed? Or would it appear on start up?
2) Should warnings be considered? I have no errors though.
Most Android emulated devices are slow. I have found that some of them simply won't render an app. This is not an indication that the physical device, which you are trying to emulate, won't work however. Try testing what works in an emulator and then creating a copy of what works in the device manager. Then make slight changes that are closer to the target device in the copy. Deploy every time to ensure that it is working. This process takes patience. If you are fortunate enough to have the physical device, debug through the USB connection.

Eclipse on Mac android bug

I am having a strange issue ever since I installed eclipse on my mac mini (switched from windows machine). I am developing an opengl app on android and if I launch the app from eclipse, the android-opengl method OnSurfaceCreated() will be called randomly trashing the game (not supposed to happen). If I launch the game from the phone without eclipse this never happens. Also I have to unplug and replug the phone every time I want to build and launch from eclipse or else the phone doesn't appear as a choice. So I am suspecting there is something wrong with ADB. Any ideas? I have a samsung galaxy SIII. Is there a driver I need to install?
This happens to me too on Eclipse installed on my mac. I had to replug the device every now and then. The problem is only of the UI. If you drag a border on the device chooser UI, it will show up. See https://stackoverflow.com/a/26425489/1306419 answer on Just upgraded my OS X to Yosemite, Android Device Chooser not showing device - what to do? .
Also regarding OnSurfaceCreated() issue, please share the error that appears in LogCat.

Using Laptop Webcam as Android Emulator's Cameta

I am trying to use my laptop webcam as my back camera of my emulator for sdk version 10 and 16, but in both case the emulator does not found my webcam though the emulator does not show any shortage of SD cart memory or also request permission for using webcam. When I run emulator's default camera app, it shows grid of gray and black with a greed rectangle moving here and there, when capturing photos it capture the same thing at that time on screen. Can anyone give me any solution please. My complete emulator configuration is:
This link can be helpful Android: How to use webcam in emulator?
Short story is:
Go to AVD manager
Select your device
Go to device properties
Change back facing camera dropdown value to "webcam0"
If it all not working you can try to use genymotion emulator http://www.genymotion.com/
It works much more faster and it easy to use your laptop webcam as back camera of the device

Categories

Resources