sudo apt install monkeyrunner
我创建了一个名为
test.py
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
我通过USB连接手机,启用USB调试,然后用
monkeyrunner test.py
但我得到了这个错误
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
com/android/monkeyrunner/ScriptRunner.console(Ljava/lang/String;)V @13: invokevirtual
Reason:
Type 'org/python/util/JLineConsole' (current frame, stack[0]) is not assignable to 'org/python/util/InteractiveConsole'
Current Frame:
bci: @13
flags: { }
locals: { 'java/lang/String', 'org/python/util/JLineConsole' }
stack: { 'org/python/util/JLineConsole' }
Bytecode:
0x0000000: 2ab8 0035 bb00 5159 b700 524c 2bb6 0053
0x0000010: b1
at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:73)
at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)