使用 ant 运行 Instrumentation 测试时出现 NoClassDefFoundError [英] NoClassDefFoundError when running Instrumentation test with ant

查看:44
本文介绍了使用 ant 运行 Instrumentation 测试时出现 NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个测试目标项目 A 和一个测试项目 B.

I have a test target project A, and a tester project B.

项目 A 在其 libs 文件夹中有 FlurryAgent.jar.

Project A has FlurryAgent.jar in its libs folder.

项目 B 在其 libs 文件夹中包含 robotium-solo-3.1.jar

Project B has robotium-solo-3.1.jar in its libs folder

当我编译并运行它们时,

When I compile and run them,

cd A
android update project -p .
cd ..
cd B
android update test-project -p . -m ../A
ant all clean debug
ant uninstall
ant installt
ant test

ant test 执行测试失败:

ant test fails to execute tests:

test:
     [echo] Running tests ...
     [exec]
     [exec] com.example.r17.test.TestOne:
     [exec] INSTRUMENTATION_RESULT: shortMsg=java.lang.NoClassDefFoundError
     [exec] INSTRUMENTATION_RESULT: longMsg=java.lang.NoClassDefFoundError: com.flurry.android.FlurryAgent
     [exec] INSTRUMENTATION_CODE: 0

我已经阅读了一些在 Eclipse 中解决这个问题的帖子/问题.但我不认为我可以在无头 Jenkins slave 上运行 Eclipse.

I've read some posts/questions that solve this problem in Eclipse. But I don't think I can run Eclipse on headless Jenkins slave.

推荐答案

http://code.google.com/p/android/issues/detail?id=27608

我向 Google 提交了问题,他们上传了临时修复程序.该修复也将包含在 v18 版本中.

I submitted the issue to Google and they uploaded a temporary fix. The fix will also be included in v18 release.

"项目成员 x...@android.com,今天(34 分钟前)从 http://tools.android.com/download 底部获取 anttasks.jar 以替换一个在你的sdk中."

"project member x...@android.com, Today (34 minutes ago) get the anttasks.jar from the bottom of http://tools.android.com/download to replace the one in your sdk."

要替换的文件在\Android\android-sdk\tools\lib\

The file to replace is at \Android\android-sdk\tools\lib\

这篇关于使用 ant 运行 Instrumentation 测试时出现 NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆