gpt4 book ai didi

android - NoClassDefFoundError : com/google/common/base/Predicate when importing MonkeyRunner in Jython

转载 作者:太空狗 更新时间:2023-10-29 15:48:48 25 4
gpt4 key购买 nike

我想使用 MonkeyRunner 生成 MotionEvent(从屏幕触摸)。我已经阅读了有关的信息 http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html .

问题是对于这个 jython 程序:

from com.android.monkeyrunner import MonkeyRunner

if __name__ == '__main__':
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()

执行时出现以下错误:

Traceback (most recent call last):
File "C:\Documents and Settings\jjungb00\python\workspace\monkey\src\runner.py", line 6, in <module>
from com.android.monkeyrunner import MonkeyRunner
java.lang.NoClassDefFoundError: com/google/common/base/Predicate

at com.android.monkeyrunner.MonkeyRunner.classDictInit(MonkeyRunner.java:48)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyJavaType.init(PyJavaType.java:534)

at org.python.core.PyType.createType(PyType.java:1264)

at org.python.core.PyType.addFromClass(PyType.java:1201)

at org.python.core.PyType.fromClass(PyType.java:1291)

...跳过一些堆栈跟踪...

Caused by: java.lang.ClassNotFoundException: com.google.common.base.Predicate

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

...

我已经从 android sdk 工具/lib 添加了 monkeyrunner.jar 作为外部库。我在 XP 上运行,使用 jython 2.5.2。

知道要做什么吗?我想我必须添加另一个库,但我不知道在哪里或哪个库。

最佳答案

您需要添加 Google 集合库 - 目前重命名为 Guava。在android SDK目录下寻找guavalib.jar。

关于android - NoClassDefFoundError : com/google/common/base/Predicate when importing MonkeyRunner in Jython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7684995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com