简体   繁体   中英

Use Robotium to test android project with library

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]

虽然没有具体到Robotium,这个职位可以在您的测试项目中使用外部库帮你。

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 item Java Build Path and select tab Order 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM