Skip to content

androidviewclient problem with the setting. #77

Closed
donenx opened this Issue Apr 15, 2014 · 17 comments

3 participants

@donenx
donenx commented Apr 15, 2014

Hi I want use androidviewclient. What can i do? This is my problem:
C:\Users\Donato Pastore>cd\

C:>cd AndroidViewClient

C:\AndroidViewClient>java -jar androidviewclient-2.3.24.jar dump
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] Script terminated due to an exception
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]Traceback (most recent call last):
File "C:\Users\Donato Pastore\dump", line 138, in
vc = ViewClient(ViewClient.connectToDeviceOrExit(kwargs1), *kwargs2)
File "C:\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1390,
in connectToDeviceOrExit
ViewClient.setAlarm(timeout+5)
File "C:\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1350,
in setAlarm
signal.alarm(timeout)
File "C:\adt-bundle-windows-x86_64-20131030\sdk\tools\lib\jython-standalone-2.
5.3.jar\Lib\signal.py", line 222, in alarm
NotImplementedError: alarm not implemented on this platform

140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyException.doRaise(PyException.java:219)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1239)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1243)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1247)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at signal$py.alarm$14(C:\adt-bundle-windows-x86_64-20131030\sdk\tools\li
b\jython-standalone-2.5.3.jar\Lib\signal.py:239)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at signal$py.call_function(C:\adt-bundle-windows-x86_64-20131030\sdk\too
ls\lib\jython-standalone-2.5.3.jar\Lib\signal.py)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:317)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.setAlarm$70(C:\AndroidViewClient\s
rc\com\dtmilano\android\viewclient.py:1350)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient
\src\com\dtmilano\android\viewclient.py)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:317)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.connectToDeviceOrExit$71(C:\Androi
dViewClient\src\com\dtmilano\android\viewclient.py:1418)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient
\src\com\dtmilano\android\viewclient.py)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.function___call__(PyFunction.java:376)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:371)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:366)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject.callextra(PyObject.java:527)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.pycode.pyx0.f$0(C:\Users\Donato Pastore\dump:140)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.pycode._pyx0.call_function(C:\Users\Donato Pastore\dump)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyCode.call(PyCode.java:18)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.runCode(Py.java:1275)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.__builtin
.execfile_flags(builtin.java:522)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225
)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.
java:77)
140415 15:33:19.664:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter
.java:189)

C:\AndroidViewClient>

@dtmilano
Owner

Upgrade to the latest AndroidViewClient version which is 100% python and does not depend on monkeyrunner or jython and you'll have no problems.

@donenx
donenx commented Apr 15, 2014

same problem...
C:\AndroidViewClient-5.1.1>cd AndroidViewClient

C:\AndroidViewClient-5.1.1\AndroidViewClient>java -jar androidviewclient-2.3.24.
jar dump
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] Script terminated due to an exception
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]Traceback (most recent call last):
File "C:\Users\Donato Pastore\dump", line 138, in
vc = ViewClient(ViewClient.connectToDeviceOrExit(kwargs1), *kwargs2)
File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\vi
ewclient.py", line 1390, in connectToDeviceOrExit
ViewClient.setAlarm(timeout+5)
File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\vi
ewclient.py", line 1350, in setAlarm
signal.alarm(timeout)
File "C:\adt-bundle-windows-x86_64-20131030\sdk\tools\lib\jython-standalone-2.
5.3.jar\Lib\signal.py", line 222, in alarm
NotImplementedError: alarm not implemented on this platform

140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyException.doRaise(PyException.java:219)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1239)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1243)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1247)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at signal$py.alarm$14(C:\adt-bundle-windows-x86_64-20131030\sdk\tools\li
b\jython-standalone-2.5.3.jar\Lib\signal.py:239)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at signal$py.call_function(C:\adt-bundle-windows-x86_64-20131030\sdk\too
ls\lib\jython-standalone-2.5.3.jar\Lib\signal.py)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:317)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.setAlarm$70(C:\AndroidViewClient-5
.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py:1350)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient
-5.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:317)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.connectToDeviceOrExit$71(C:\Androi
dViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py:1418)

140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient
-5.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.function___call__(PyFunction.java:376)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:371)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.call(PyFunction.java:366)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject.callextra(PyObject.java:527)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.pycode.pyx0.f$0(C:\Users\Donato Pastore\dump:140)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.pycode._pyx0.call_function(C:\Users\Donato Pastore\dump)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyCode.call(PyCode.java:18)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.runCode(Py.java:1275)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.__builtin
.execfile_flags(builtin.java:522)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225
)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.
java:77)
140415 19:11:13.199:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter
.java:189)

C:\AndroidViewClient-5.1.1\AndroidViewClient>

@dtmilano
Owner
@donenx
donenx commented Apr 16, 2014

ok, but when i run for example browser-open-url (a script python of androidviewclient in examples) , with this configuration "http://dtmilano.blogspot.it/2012/03/eclipse-working-monkeyrunner.html" i have this error in eclipse:
Traceback (most recent call last):
File "C:\adt-bundle-windows-x86_64-20131030\sdk\tools\workspace\pp\browser-open-url.py", line 33, in
device, serialno = ViewClient.connectToDeviceOrExit()
File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1391, in connectToDeviceOrExit
device = adbclient.AdbClient(serialno)
File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\adb\adbclient.py", line 89, in init
self.__setTransport()
File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\adb\adbclient.py", line 218, in __setTransport
raise RuntimeError("ERROR: couldn't find device that matches '%s'" % self.serialno)
RuntimeError: ERROR: couldn't find device that matches '.*'

@dtmilano
Owner
@donenx
donenx commented Apr 16, 2014

i have changed the device and something work. I have only one problem . Why this error?
Traceback (most recent call last):
File "C:\adt-bundle-windows-x86_64-20131030\sdk\tools\workspace\avc2\settings-display.py", line 45, in
vc = ViewClient(device, serialno)

File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1132, in init
self.serialno = self.__mapSerialNo(serialno)
File "C:\AndroidViewClient-5.1.1\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1312, in __mapSerialNo
raise ValueError("Regular expression not supported as serialno in ViewClient")
ValueError: Regular expression not supported as serialno in ViewClient

@donenx
donenx commented Apr 16, 2014

C:>adb devices
List of devices attached
BX902EVPWD device

@dtmilano
Owner
@donenx
donenx commented Apr 17, 2014

Hi Diego thanks, work also for me. I have another question for you.. There is a way for view a list of all default activity of my device? For example com.android.settings or com.android.mms

@dtmilano
Owner
@donenx
donenx commented Apr 18, 2014

is there a way to make the touch of these items?
android.view.View id/no_id/29 <------ this
android.widget.TextView id/no_id/30 Carico
android.widget.LinearLayout id/no_id/31 <-------this
android.widget.TextView id/no_id/32 Nessuna scheda SIM

@dtmilano
Owner
@donenx
donenx commented Apr 27, 2014

when i run this method, it's all ok ...
def test() :
package='com.android.settings'
activity='.Settings'
component=package + "/" + activity
device, serialno = ViewClient.connectToDeviceOrExit()
device.startActivity(component=component)

but if i want run it, for example with the package:/system/app/GoogleEarth.apk=com.google.earth
whit this code

def test() :

package = 'com.google.earth'
activity = 'GoogleEarth'
component = package + "/" + activity

device, serialno = ViewClient.connectToDeviceOrExit()
device.startActivity(component=component)

i have this Error: Activity class {com.google.earth/GoogleEarth} does not exist.

@dtmilano
Owner
@dtmilano dtmilano closed this May 24, 2014
@yourng2794

logo@logo:~/CTS/AndroidViewClient-master$ ./Deviceadmin.py
Traceback (most recent call last):
File "./Deviceadmin.py", line 43, in
vc = ViewClient(device=device, serialno=serialno)
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-10.5.1-py2.7.egg/com/dtmilano/android/viewclient.py", line 2324, in init
self.serialno = self.__mapSerialNo(serialno)
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-10.5.1-py2.7.egg/com/dtmilano/android/viewclient.py", line 2466, in __mapSerialNo
raise ValueError("Regular expression not supported as serialno in ViewClient. Found '%s'" % serialno)
ValueError: Regular expression not supported as serialno in ViewClient. Found 'adb server is out of date. killing...

  • daemon started successfully * unknown'
@dtmilano
Owner

If your intention is to use regular expressions for the serial numbers you should use ViewClient.connectToDeviceOrExit() as culebra generated scripts do:

...
kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {'compresseddump': True, 'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True}
vc = ViewClient(device, serialno, **kwargs2)
...

in this case the serial number, which can be a regular expression is taken from the script command line

example.py 0.*

will attempt to connect to a device with serial number starting with 0.

If you don't want this, you can always specify the serialno in your call as in

device, serialno = ViewClient.connectToDeviceOrExit(serialno='0.*', **kwargs1)
@dtmilano
Owner

Also, please create new issues or StackOverflow questions at http://stackoverflow.com/questions/tagged/androidviewclient, not just add unrelated comments to closed issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.