Runtime Exception when running android uiAutomator - android

i'm trying to automate the settings in my android device(input wifi password, create account display setting etc) using uiautomator.
But the behaviour of the code is quite unpridictable.
Sometimes it works totally fine, and other time it give the following exception on the same device, under the same conditions.
INSTRUMENTATION_RESULT: shortMsg=java.lang.RuntimeException
INSTRUMENTATION_RESULT: LONGMsg=ChangeDisplaySetting ## this is the name of the class
INSTRUMENTATION_CODE: 0
m quite unable to figure out the reason. Also the code is quite large, and i dont know, which part shall i copy here.
Please guide.
Also it would be helpful, if there exits some other way(like some other language) of doing the same. I was studying about python, but i'm not sure, if it would perform all the functions on user mode.
Please guide.

You are welcome to try https://github.com/xiaocong/uiautomator. You can install it via pip install uiautomator, although it's under developing phase.

Related

Can we run a Corda node on an Android mobile device?

I'm working on creating a CordApp which I'm expecting to run on user's phone. Android as a starting point. From my reading so far, Android phones do not have a JVM running on the phone and the compiled code is converted into either Dalvik or something similar.
Has someone tried to install their CorDapp on an android based mobile device?
I'm a nooby in the area of CordApp as well in android apps but hoping that I can find some good starting tips here. Thanks for help.
The bottom line is that Corda needs a JVM environment to execute. The most light-weight test we have tried is Raspberry Pi with 2G Memory.
(answering the follow-up in the comment above)
You might be able to run several distinct nodes on some server. However at that point there would be little point in using Corda in the first place.
Once you run a node "somewhere else" the user won't own the private key for its node, and all the safety of using Corda disappears. You're reverting to a 'trusted third party' model.

Can we edit maxDepth in Firebase robotest. If yes, how?

I am trying to automate the "UI testing" for my android application by using firebase testlab. I have saved a script in android studio but want to limit the robot for any further monkey testing. All it does is after my sctipts runs successfully, it starts doing monkey testing, which is of no use to me.
I read it online it can be controlled using "maxDepth" but couldn't find anything more. Would appreciate if someone could help me implement this.
maxDepth was only supported by Robo v1. It has been deprecated and has not had any effect on Robo tests for a long time. The standard way to limit the length of a Robo test now is to use the timeout flag/option.
A possible(?) alternative would be to have your Robo script exit your app when it is done, but I have never tried that and am not sure how it would work.

fastlane screengrab and snapshot

I'm using fastlane tools (https://fastlane.tools) for automating all screenshots for my iOS and Android apps. The tool works very well and I'm happy with it. The problem i'm having is that when I have mixpanel events and other analytics running on the app the app will run those events during screenshots. Is there a way to "detect" in code that it's a screenshot event with simulators?
Basically, I want some sort of if statement but not sure how to tell its from fastlane. I have thoroughly read through the documentation and wasn't able to find anything for this, any help is appreciated!
My current solution involves simply checking if the user is running on a simulator or is running in debug mode. In which case, it doesn't perform the code I want to filter out.

Android screenshot - How to?

Is there any neat way of accessing screenshot of android device
programatically. I am looking for some 15-20fps.
I found one code
android\generic\frameworks\base\services\surfaceflinger\tests\screencap\scr eencap.cpp,
i built the executable and put it in /data and changed the mode 777
but when i tried to execute it using adb shell it gives the below error.
# chmod 777 test-screencap
chmod 777 test-screencap
# ./test-screencap test
./test-screencap test
screen capture failed: Function not implemented
I also know that we can access fb0 but its not a right method as suggested
by android team. Is it possible to access the screen shot at the frameworks
layer. I beleive surface flinger composes individual layers and gives it to
framebuffer.Where exactly this is done ? Can a application be able to access
such codes.
There are some java apps also which use ddms to actually capture this
framebuffer data without root access. But the fps is really poor.
I beleive there should be some or the other way of doing the above job.
Please suggest me some neat way of doing it. Suggestions are welcome.
What you are trying to do is not possible if you don't have a rooted phone, there is an app out there that does what you are trying, Screenshot ER. The latest OEM's are putting it into their /system/apps now... so you may be able to use their apps, check out this article for devices that have enabled this feature. Other than that your really stuck but there are implications with screen captures enabled as this could lead apps saving screen captures and sending that info out, enabling virus type apps...
Information for others .....Through Eclipse you can get a screen capture usig the DDMS perspective. If you take a look at the Eclipse DDMS code base its actually a stand-alone app too. You might be able to use this Java code then.
AdbHelper.getFrameBuffer(AndroidDebugBridge.getSocketAddress(), this);
Take a look at droid VNC Server
This is an open source project which you can clone the source code to your private PC. (http://github.com/oNaiPs/droid-VNC-server). I am investigating how VNC can do but It's really hard to do the same.
Read framebuffer content is an good solution also. But it just work with android <3.x only. I don't know how to fix it to work on android 4.x. If you know how (after see my suggestion) please share it here. Through my researching, I see that there are a lot of people looking for this.
Hope this helps.
nguyenminhbinh1602#gmail.com.
Android Freelancer.

Profiling Android applications using ltrace

I need to profile dynamic library calls of android application and have decided to profile using "ltrace" tool for this purpose. I combined "ltrace" tool into android package, then compiled together successfully. It works fine with shell program just like usual linux console application.
However, I cannot properly profile android applications, which are forked from "Zygote" process. I tried attaching ltrace to "Zygote" process to follow child processes of it, but I only got SIGCHLD and SIGSTOP signals and terminated abnormally, showing the following errors.
unexpected instruction 0xffffffff at 0xffff0508
I'm just wondering if anyone has ever tried this kind of profiling on android system. Any short comments can be very helpful for me.
Thank you in advance.
Try attaching ltrace to your android application's process after it is it forked off zygote. You will need an ltrace built for android's bionic libc, and one that has reasonable handling of threads.
There is a way to set a debuggable android app to wait for connection of the java debugger, you could use that, connect ltrace, and then connect and disconnect the java debugger to start it going again. This should capture most of your own logic, though not the entirety of the startup.
IIRC you are under a time limit to connect and get it going again, otherwise it may resume on its own to avoid triggering an application not responding situation.
It may be that you will learn more by using the java debugger to see what is going on, and then reading the source to see how that is implemented on the native side.
Mr. Chris Stratton's way will work.
LoadLibrary() is another point to break for debbuging jni.

Categories

Resources