在 Jython 中导入 MonkeyRunner 时出现 NoClassDefFoundError: com/google/common/base/Predicate

发布于 2024-12-08 09:51:54 字数 1846 浏览 0 评论 0原文

我想使用 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 tool/lib 添加了monkeyrunner.jar 作为外部库。 我在 XP 上运行,使用 jython 2.5.2。

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

I want to use MonkeyRunner to generate MotionEvent (from screen touch). I have read the info on
http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html.

The problem is that for this jython program:

from com.android.monkeyrunner import MonkeyRunner

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

I get the following error when executed:

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)

...
skipping some stack trace
...

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)

...

I have added monkeyrunner.jar from the android sdk tool/lib as an external library.
I'm running on XP, with jython 2.5.2.

Any idea what to do? I guess I must add another library, but I do not know where or which.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

变身佩奇 2024-12-15 09:51:54

您需要添加 Google Collections 库 - 目前已重命名为 Guava。在android SDK目录中查找guavalib.jar。

You need to add the Google Collections library - currently renamed to Guava. Look for guavalib.jar in the android SDK directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文