运行Monkey runner脚本时出现NoClassDefFoundError

时间:2011-11-08 11:36:36

标签: android noclassdeffounderror monkeyrunner

我在我的应用程序中第一次运行 monkey runner script ,但我收到以下错误:

D:\android softwares\AndroidSDK\tools>monkeyrunner.bat test1.py
Exception in thread "main" java.lang.NoClassDefFoundError: com/android/chimpchat
/ChimpChat
        at com.android.monkeyrunner.MonkeyRunnerStarter.<init>(MonkeyRunnerStart
er.java:60)
        at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter
.java:188)
Caused by: java.lang.ClassNotFoundException: com.android.chimpchat.ChimpChat
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 2 more

但我无法解决这个问题。请帮忙......

这是我的剧本:

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

device = MonkeyRunner.waitForConnection()

device.installPackage('myfile.apk')

package = 'com.example.android.myapplication'

runComponent = 'com.example.android.myapplication/.Home'

device.startActivity(component=runComponent )

device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)

result = device.takeSnapshot()

result.writeToFile('/shot1.png','png')

谢谢, 拉姆。

1 个答案:

答案 0 :(得分:1)

根据this,r15有一个解决方法。