使用Robotium通过库测试android项目
我有一个 Android 应用程序,其中包含一个包含源代码的库项目。然后,我有两个额外的项目,用于管理应用程序的专业版和精简版。
我无法让 Robotium 从我的代理应用程序(专业版和精简版,通过模块引用引用库)或库本身加载类文件。我尝试了一堆不同的类名和引用,但测试项目在下面失败了。
public MainTest() {
super("com.joe.app.lib", Main.class);
}
我在这里没有找到任何关于在 android 中测试库项目的讨论。寻求建议。
错误消息
java.lang.RuntimeException:无法在加载程序 dalvik 中实例化活动 ComponentInfo{com.joe.app.tests/com.job.app.tests.MainTest}:java.lang.ClassNotFoundException:com.joe.tests.MainTest。 system.PathClassLoader[/data/app/com.joe.app.tests-1.apk]
I have an android application consisting of a library project that contains the source code. I then have two additional projects, that are used to manage a pro, and lite version of the app.
I have been unable to get robotium to load the class files from either of my proxy apps(pro and lite, which reference the library via a module reference), or the library itself. I have tried a bunch of different class names, and references, but the test project fails below.
public MainTest() {
super("com.joe.app.lib", Main.class);
}
I haven't found any discussion here about testing with library projects in android. Looking for advice.
Error msg
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.joe.app.tests/com.job.app.tests.MainTest}: java.lang.ClassNotFoundException: com.joe.tests.MainTest in loader dalvik.system.PathClassLoader[/data/app/com.joe.app.tests-1.apk]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尚未找到解决方案,或者其他人由于上次 adt 更新后出现类似错误而遇到此问题。
在测试项目的
Project Properties
中,转到Java Build Path
项并选择Order and Export
选项卡。在那里,您必须检查您正在测试的项目,以便其正确导出。对于最新的 ADT,您还必须在项目中导出
Android Private Libraries
。In case you haven't found a solution yet or others are getting to this question due to similar errors after the last the adt update.
In
Project Properties
of your Test Project go to itemJava Build Path
and select tabOrder and Export
. There you'll have to check the project you're testing against so it's properly exported.For latest ADT you also have to have the
Android Private Libraries
exported in your projects.