0

自動化のために AndroidViewClient を使用しようとしています。[github][1] に「セキュアモード」に関するページがあります。これは次のように述べています。

AndroidViewClient には、次の 2 つのバックエンドがあります。

  • ViewServer
  • UiAutomator

UiAutomator は Android API 16 以降で動作するため、デバイスに以前のバージョンがある場合、唯一の代替手段は ViewServer です。

dump.py を実行しようとしていますが、「デバイスは安全です」というエラーが表示されます。セキュア モードのページには、「唯一の選択肢は ViewServer です」と記載されています。viewServer とは何ですか?monkeyrunner で使用するにはどうすればよいですか?

githubページのこの画像によると、APIレベル16以上を持っていない場合、ID名があればそれを使用できるため、これを理解するのに苦労しています(私はそうしています)。それを行う方法を知っています。

要約すれば、

API レベル 15 以下のデバイスとソース コードがあり、viewID を使用してアプリケーションを自動化したいと考えています。それは可能ですか?

最後のエラー:

C:\Users\EGHDK\android-sdk\tools>monkeyrunner C:\AndroidViewClient-master\Andro
idViewClient-master\AndroidViewClient\examples\dump.py --ignore-secure-device --
do-not-start-view-server
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] Script terminated due to an exception
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]Traceback (most recent call last):
  File "C:\AndroidViewClient-master\AndroidViewClient-master\AndroidViewClient\e
xamples\dump.py", line 79, in <module>
    ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2).traverse
(transform=transform)
  File "C:\AndroidViewClient-master\AndroidViewClient-master\AndroidViewClient\s
rc\com\dtmilano\android\viewclient.py", line 991, in __init__
    subprocess.check_call([adb, '-s', self.serialno, 'forward', 'tcp:%d' % self.
localPort,
  File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 469, in check_call
  File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 456, in call
  File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 755, in __init__
  File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 1269, in _execute_child
OSError: Cannot run program "C:\Windows\system32\adb.exe" (in directory "C:\User
s\EGHDK\android-sdk\tools"): CreateProcess error=2, The system cannot find the
file specified

130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyException.doRaise(PyException.java:219)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.Py.makeException(Py.java:1159)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.Py.makeException(Py.java:1163)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.Py.makeException(Py.java:1167)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py._execute_child$36(C:\Users\EGHDK\android-sdk\tools\lib
\jython.jar\Lib\subprocess.py:1270)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:191)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:385)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyMethod.__call__(PyMethod.java:215)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyMethod.__call__(PyMethod.java:206)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyObject.__call__(PyObject.java:367)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyObject.__call__(PyObject.java:371)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.__init__$19(C:\Users\EGHDK\android-sdk\tools\lib\jytho
n.jar\Lib\subprocess.py:844)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:191)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:385)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyMethod.__call__(PyMethod.java:215)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyMethod.__call__(PyMethod.java:206)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyObjectDerived.dispatch__init__(PyObjectDerived.java
:1097)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyType.invoke_new_(PyType.java:444)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyType.type___call__(PyType.java:1374)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyType.__call__(PyType.java:1365)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyObject._callextra(PyObject.java:537)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.call$7(C:\Users\EGHDK\android-sdk\tools\lib\jython.jar
\Lib\subprocess.py:456)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:370)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.function___call__(PyFunction.java:375)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:365)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyObject._callextra(PyObject.java:537)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.check_call$8(C:\Users\EGHDK\android-sdk\tools\lib\jyth
on.jar\Lib\subprocess.py:475)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:124)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:317)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at com.dtmilano.android.viewclient$py.__init__$54(C:\AndroidViewClient-m
aster\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewcl
ient.py:995)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient
-master\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\view
client.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyBaseCode.call(PyBaseCode.java:191)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:385)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyFunction.__call__(PyFunction.java:380)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyInstance.__init__(PyInstance.java:120)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyClass.__call__(PyClass.java:194)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyObject._callextra(PyObject.java:537)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.pycode._pyx0.f$0(C:\AndroidViewClient-master\AndroidViewCl
ient-master\AndroidViewClient\examples\dump.py:79)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.pycode._pyx0.call_function(C:\AndroidViewClient-master\And
roidViewClient-master\AndroidViewClient\examples\dump.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.PyCode.call(PyCode.java:18)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.Py.runCode(Py.java:1197)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.core.__builtin__.execfile_flags(__builtin__.java:538)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:156
)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.
java:77)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]       at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter
.java:189)
4

1 に答える 1

1

デバイスのAPIレベルが16 未満の場合、代替手段は次のとおりです (この画像に示すように)。

  • アプリケーションのソース コードにアクセスできる場合は、LocalViewServer 。LocalViewServer は ViewServer のフォークです
  • エミュレータを使用する (セキュア モードは無効)
  • デバイスをルート化し、セキュア モードを自分で無効にする

LocalViewServerLocalViewServerActivityを備えており、アクティビティでのViewServer の実装を簡素化するために拡張できます。

TemperatureConverterActivityのサンプル ソース コードを確認してください。

あなたが投稿したエラーの理由は次のようです:

OSError: Cannot run program "C:\Windows\system32\adb.exe" (in directory "C:\User
s\EGHDK\android-sdk\tools"): CreateProcess error=2, The system cannot find the
file specified

Android SDK のインストールを指すように、環境変数 ANDROID_HOME を正しく設定する必要があります。

于 2013-04-24T21:29:18.077 に答える