UI Automator Viewer: receiving "Error taking device screenshot: null" every time from AVD device - android-virtual-device

This only happends on the AVD devices within the AVD manager. I never get this error when capturing uiautomatorviewer screenshots from Genymotion.
When attempting to capture within the Android Device Monitor in AS...it gives me a little more detail:
Reason:
Error obtaining UI hierarchy

Try it with HAXM acceleration turned off, if you can. I had to run the test using a profile that then ran the test on a physical device to get the screen shots. Essentially, if the AVD has Use GPU or Snapshot selected - even if running on a USB attached device, screenshots fail. This is a bug in uiautomator according to the developers involved with maturing the Appium platform.

In addition to answer given by Houston Haynes, the problem can happen if you have set the flags for your activity like this:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
You can just comment the code and take the screenshots via anything(Android Studio, uiatutomatorviewer etc). Hope it helps!!

Related

Unity Crash on MacOS when the join method is invoked (Agora.io)

I downloaded the agora.io video sdk asset from the asset store, imported it to a new project. On the demo "SceneHome" scene, I entered the api id. Clicked play, and as soon as I click the "join" button Unity crashes. As far as I can tell the crash happens on the
app.join(field.text);
line in the TestHome.cs script (line #86).
I tested it in 2019.3.2f1 and 2020.1.0b5. The result was the same.
The OS is Catalina 10.15.4.
The demo works on Windows.
I followed this tutorial: https://medium.com/#jake_agora.io/mac-run-video-chat-within-your-unity-application-e001091db62f but used x86_64 dlls instead of x86
Does anyone know what this is about? Or where should I begin to look?
Another tutorial, this one from Agora:
https://www.agora.io/en/blog/run-video-chat-within-your-unity-application-mac
It can be caused by missing the Camera and Microphone usage in the Unity Editor project setting. Please let us know if that's the case. (I saw you are also on the Slack channel, let's continue the conversation there.).
For the people who didn't know, Agora Developer Community - Unity Chat channel is here :)
As herve nau pointed out the problem was that the Unity did not had the permission to use camera or microphone. And the solution should work. Alternatively, here is another way to add the permission as described by launzone:
1) Disable SIP: Go into recovery mode (hold CMD+R when you
restart your Mac) Don't be afraid, we are not doing anything crazy.
2) After that open Terminal (it should be accessible from one of the
Menus at the Top) Type in "csrutil disable" and hit enter. Then reboot
your Mac normally.
3) Open Terminal and type in: "sqlite3 ~/Library/Application\
Support/com.apple.TCC/TCC.db" and hit enter
4) For microphone access, type in: "INSERT INTO access
VALUES('kTCCServiceMicrophone','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
and hit enter
For camera, type in: "INSERT INTO access
VALUES('kTCCServiceCamera','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
and hit enter
6) check in your SystemPreferences/Security&Privacy > unity hub should
now show up in both mic and cam
7) reboot in recovery mode again (CMD+R), open terminal again, type
in: "csrutil enable" and hit enter, to enable SIP again
8) reboot normally and enjoy!
Here is the full thread. I hope it helps someone :)
check if not related to the webcam registration issue on macOs with the Unity Hub running. Fix for the camera, not sure if related to your problem: Remove the Unity Hub app, then open the project directly from Unity App. May also be useful to relocate the Unity app in another folder to force the webcam usage security registration.
Made the test here, Unity 2019.3.11.f1, using the demo app, with Hub active -> crash on press of Join Button, did the Hub removal described above, rerun the same demo and no more crash at this level. Running on Catalina 10.15.2.

Visual Studio 2019 Xamarin Forms android emulator failing with message System UI isn't responding

Getting an error message, 'System UI isn't responding.' and it gives me the options 'Close app' or 'Wait' when debugging Xamarin.Forms. This is on the emulator that launches. I have set the memory at 512 and the resolution at 800x600 as some have suggested in other threads. I also did a 'factory reset.' Nothing has helped so far.
Are there any other options that may get me past this? I just purchased a Xamarin class from Udemy and can't even get past the first few videos.
I should mention that I do not think I am short on resources. I have two 500 GB SSD drives and the following memory and processor specs.
First of all, please make sure your have enabled the Hardware acceleration for emulator, https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?pivots=windows
If you enabled it, please delete this emulator, create a emulator like this screenshot.
https://imgur.com/a/ZyBakKc
I resolved this issue by going to Tools in Visual Studio. Tools > Android > Android Device Manager > select and edit property (hw.gpu.mode) of emulator to mesa

Appcelerator doesn't detect android phone

Goodmorning,
I'm working quite hard on my own app. At this point I want to run it on my android (galaxy note 3) phone. Unfortunately Appcelerator studio doesn't detect my android phone; Windows does. I've tried it with the new Galaxy s7 of a friend, but same result.
Off course I searched the web like crazy and found several possible (old) answers, but none did the magic.
When I consult the log, there's no new info to be read!
Does anyone have a clue where to look? Looking forward to your answers…
Kind regards!
One thing you should check is if you have set up your phone for development. You can see the instructions here: http://developer.android.com/tools/device.html (... tap 7 times... - took me a while to discover!)
And the small obvious thing is in Appcecelerator Studio you may need to select "Refresh devices" when you try to run the project.
/John
When you say "Windows" detects it, what exactly do you mean? Does adb detect it?
If you run
adb devices
on the command line, does it report your device ID?
On my Mac, I run this and I can see my connected S4:
List of devices attached
9726ea90 device
I'm assuming that the Windows version of adb would output a similar report.
With all the Samsung phones I've debugged with, I always have to go to the notification bar and choose "connect as media device" (or something similar). The default connection mode does not work for debugging. And unfortunately, you have to do this every time you connect the device.

Android Wear can't connect my device via bluetooth

I enabled debugging over bluetooth on my Moto 360
and enabled Android Wear app on my Nexus4.
Status displays target : disconnected
Forwarding the port from my computer shows the status host will be changed to connected, but the target status remains disconnected.
I toggled debug via the bluetooth switch which had no effect.
My phone is a Nexus 4. Is there a problem with my phone or the Moto 360?
I eventually managed to get it working. The issue seems to be related to having paired your device with an emulator first. Take a look at this post to see how I fixed it: http://melix.github.io/blog/2014/10/android-moto360.html
open the applications settings, search for the Android Wear application, then force stop it
clear its data and cache
Search for Google Play Services
Click on Manage space. Delete all data.
reboot your phone
reset your Moto 360
Pair watch with phone
Following the instructions from android.com https://developer.android.com/training/wearables/apps/bt-debugging.html to setup debugging and it should work now.
Done.
I tried it on a Sony z1.
It succeeded without any problems.
So, maybe it's not supported perfectly in Nexus 4.
If you have the same problem, I suggest using another device.
I fixed without factory reset with these steps
-Force stop android wear application and clear cache
-Disconnect emulator on android wear app
-Forget emulator on android wear app
-Connect your real device via bluetooth
-Open debugging over bluetooth
Make sure that debugging options are also active in android wear device
Run this commands in command window:
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444

Stop Android AVD showing location change toast

Whenever I change location on my AVD, whether it's via telnet or in DDMS I get a system toast message saying 'my current location is .....'
It's really annoying as it's covering up my app which is showing these details.
I can't find a way of removing it and searching didn't show much up. Any ideas?
Checked on my AVDs with Android 4.4 and I can safely say this toast is not part of Android system, and I can only assume this toast is being shown probably by a tool or an application you previously installed on the AVD.
My suggestion for you is to track LogCat whenever you send a mock location and see which events are being recorded to log when the toast is being displayed. If such an event is recorded, track it to the source package and remove that package by running adb uninstall <package_name>. If this fails, try creating a new AVD and send a mock location to it before making any changes to the machine, then incrementally install whatever tools and applications you need to identify the culprit.
Do you have any extra libraries or modules setup with your application? My first thoughts would be that some other library you added may have a toast built in and their code is calling it at some point. If you do try looking in those libraries and remove the toast code.

Resources