I went to use hierarchyviewer and recieved the following message:
"The standalone version of hieararchyviewer is deprecated.
Please use Android Device Monitor (tools/monitor) instead."
So, I started up Android Device Monitor in Android Studio and could only find
"Dump View Hierarchy for UI Automator"
and it launches uiautomatorviewer in the Device Monitor...
Does anyone know if this means Google is intending to replace hierarchyviewer with uiautomatorviewer?
To start the Hierarchy Viewer from Android Studio:
Start Android Device Monitor
Click the Open Perspectives icon and select Hierarchy View.
Step 2
I used to use the hierarchyviewer in combination with monkeyrunner to do UI testing for android devices. Unfortunately, monkeyrunner was slow and limited and the tests were brittle.
I see the uiautomator as the better tool for inspecting UI elements. It has more powerful methods to identify UI objects and interact with them.
You no longer need to place sleep commands in your script. Just wait for a specific element. You can wait for an element to appear or disappear.
You can have watchers which run in case an UI object is not found. This can be helpful when handling pop-ups and error messages.
Here's a link to a tutorial.
http://developer.android.com/tools/testing/testing_ui.html
I did not see any official statement that says one replaces the other, but I think upgrading to uiautomator is the sensible thing to do. Hierarchyviewer and monkeyrunner are deprecated after all.
Related
Since I upgraded my Android Studio installation to Bumblebee, the emulator has become unusable. It either crashes during startup or gets itself stuck so that the UI is unresponsive and the debugger either cannot install or cannot launch an app. The way in which it fails varies from time to time for no reason that I can understand. although different virtual devices seem to behave differently. I tried deleting my old virtual devices and creating new ones, but that didn't help.
I can't debug my code on a real phone because of a different problem, see my recent answer to Source code does not match the bytecode for Android's View.java.
When it crashes I send a crash report to Google, but they don't seem to be fixing it. The problems started with the first official Bumblebee release 2021.1.1, which seemed to have a complete new version of the emulator, and I'm now on the latest stable version 2021.1.1 Patch 2.
My environment is a Dell Precision M4800 with 16GB of RAM and an 8-core Intel processor, using an external 4K monitor and an external full-size keyboard, running Linux openSUSE Leap 15.3 with all recommended patches installed.
Does anyone have any suggestion short of throwing away my entire Android Studio installation and reverting back to Arctic Fox? Has anyone else seen similar problems?
Tintin's answer didn't work for me: Device Frame wasn't enabled anyway because I had noticed that it had caused problems before.
However the following sequence rather surprisingly, at least to me, did fix the problem.
First make sure that the toolbar is visible at the top of the emulator window: if it isn't, click on the gear settings icon at the top right of the emulator window and enable Show Toolbar.
Start up an emulated virtual device, and before it crashes click on the three dots at the right hand end of the toolbar: this will bring up the extended controls window.
Choose Settings from the list at the left of the extended controls list.
Set the OpenGL ES renderer to Desktop native OpenGL, and the OpenGL ES API to Compatibility (OpenGL ES 1.1/2.0).
Close the extended controls window and then close the Android Emulator window.
Check if there are any zombie emulator or qemu processes still running. If there are, kill them: you'll need kill -9 on Linux.
Try to cold boot an emulated virtual device: it will probably crash before it even gets started up properly.
Close the Android Emulator window and repeat step 6
Try to cold boot an emulated virtual device again, but click on the three dots quickly before it crashes.
When the extended controls list comes up, choose Settings from the list at the left.
Set the OpenGL ES renderer back to SwiftShader, and the OpenGL ES API back to Renderer maximum (up to OpenGL ES 3.1).
Repeat steps 5 and 6.
Now try to boot up an emulated virtual device again. It should work: at least it does for me.
If it doesn't work on your configuration, try all possible combinations of the OpenGL ES settings: you may find one that works.
Logically, changing the OpenGL ES settings and then changing them back again shouldn't do anything, but it does. My guess is that perhaps some needed bit of initialisation for the OpenGL isn't being done by the installer, but it gets done when you change the configuration.
I also faced this problem in both updates in 2021.1.1 it was not working at all. Updated to patch 2 again faced problems turned off Enabled Device Frame it is working OK now
I wrote a Flutter Widget plugin with user interface automated testing using Android Studio based on Flutter documentation.
Tests execute properly but are quite abstract to write without following what happens on the device UI. All I see is that the test executes properly and the duration. The device is plugged and works properly but shows nothing related to the tests.
Is there a way to execute the UI tests from Android Studio and follow the execution on the device UI to simplify the writing of UI tests?
I would like to avoid using a solution based on screenshots as it would not be convenient to have to continuously open an image to follow what is happening.
As explained in the Flutter documentation, there are 3 types of tests:
Unit
Widget
Integration
Integration testing is the one that allows following the test execution on a device or a simulator.
I am trying to debug some OpenGL code, so I wanted to make use of the GPU debugger from Android Studio. For this I need to get a GPU trace, according to the steps detailed at https://developer.android.com/studio/debug/am-gpu-debugger-trace.html. But, after the dialog for trace name, Android Studio shows directly the message: Failed to attach to process.
Android Studio has version 2.3, and was recently updated.
On the device (Samsung S3) I see the alert: !Waiting for debugger.. process zzz is waiting for debugger to attach.
I tried to enable all GPU related options from developer options in device settings, also to disable all, with the same result. Is this feature working? My setup is not very uncommon.
I reached to a point where I get the message: The GPU debugger does not currently support tracing on this device. So the answer would be that it does not work on S3. I'll leave the question here, maybe it will save someone a few hours of investigation.
When trying to enable Run/Debug Configurations>Profiling>Capture GPU Commands, I was required to install "GPU Tools". Then, after accepting to install, it complained that they were already installed in the folder, and I should remove them prior to new installation. So I moved them away. Then it would give the error from the question.
After some attempts, I decided to put the contents of the folder back, deselect/select again Capture GPU. It said once again that I needed to install GPU tools, but this time I did nothing. The checkbox got checked anyway, and when trying to start the trace, went on to do some stuff without complaining about the attaching to the process. Finally it did not work anyway, but at least I know the reason.
I have been trying for days to get a simple app any app made in livecode to display either on my tablet, smartphone or emulator. It just doesn't work. Here is what I have done:
I have installed my sdk and pointed livecode to it in preferences.
Picked 2.3 as my version
Check my google usb drivers and they are up to date.
I followed live code's step by step and no success. I am thinking that since I am running windows 7 not a Mac, maybe this cant be done. It seems all the developers run Mac's?
I even tried to make a .apk, It made the file but " There was a problem parsing the package" once I got it on my Galaxy tab. I made sure that I checked the box to allow programs to run on my tablet. So I am still stuck.
To see if the SDK is working correctly you could try to use the Android SDK emulator first.
Open the Android SDK Manager and select the menu Tools->Manage AVDs.
There you can create a virtual Android device and run it.
If the virtual device is running you can see the virtual device under "Development->Test Target in Livecode. Select it and either select "Test" under "Development" or press the "Test" button. Does this work?
That error message means that the operating system on your device is preventing the app from being installed. The most likely reason for this is that you haven't changed the "Allow installation of apps from Unknown Sources" setting on your Galaxy Tab. There are other reasons and solutions for this error message - to see them visit Panagiotis's excellent blog post on the LiveCode website, your error message is in the fifth example
https://livecode.com/how-to-deploy-apps-to-android-devices/
I know about firebug and the developer tools for the major modern desktop browsers, but I can't find any way of debugging JavaScript code on mobile browsers.
What are some high level techniques I can use to debug code on mobile browsers?
Android devices can be put into developer mode by going through settings>Phone status then tapping on "Build number" 7 times. This allows you to do a bunch of things (see step 5) including USB debugging. (Some devices might have Build number under Software Info)
To activate USB debugging, look in Settings for the newly appeared "{ } Developer Options", open this and switch on USB debugging. Connect your device using a direct USB connection.
In Chrome on your desktop, in the usual developer tools panel used for debugging, look in the menu for more tools>remote devices. With Discover USB devices selected, you should now see your mobile device on the side.
Select it to see a list of all the chrome tabs you have open and the ability to enter URLs directly.
Selecting one of the links will open up a new window with a mirror of your device screen on the left and all the familiar chrome debug tools on the right. You can still control your device directly or use the mouse on the mirrored screen. It even rotates.
full details on remote debugging from google and how to enable developer mode (link as above) from askvg.com
Android provides a tool set for these purposes:
https://developers.google.com/web/tools/chrome-devtools/remote-debugging/?utm_source=dcc&utm_medium=redirect&utm_campaign=2016q3
Apple does it a similar way:
https://developer.apple.com/safari/tools/
Tutorial: https://css-tricks.com/using-chrome-devtools-to-debug-javascript-in-any-browser-with-ghostlab-2/
You can debug on Safari Mobile with any iPhone/iPad. In Developer menu you can find your device and you can then debug your code with inspector.
If you have an Android Device instead, you can debug on Chrome Desktop (remember to active the debug mode) with chrome://inspect
On the IPhone you can go into settings>Safari>advanced and turn web inspector on
Sometimes I get bugs reported by customers that are not reproducible every time or in our testing. For such cases I recommend Lucky Orange. It records the user activity and also has the option to record console messages.
PS - I'm not an affiliate, I use them for my own projects and like it.
Another solution for basic debugging (which many times is all is needed), is having a console polyfill on mobile without the need to plug into USB on desktop.
mobileConsole is such a console polyfill.
Hope it helps someone, I found it useful.