1

I would like to test my library in an android application, but I would like to avoid compiling and moving around .jar files.

In Xcode for iOs development, it's possible to add your library project in your workspace inside your other project (a test app) and when you run your test app, it builds the library and links everything up correctly.

Can I do this for Android development in Eclipse? How can I do this?

I tried to add a library but it seemed very manual which isn't ideal on time.

The important thing here is that I do have Android references and dependancies, so i can't just unit test the library by itself. I am also creating an SQLite database which I would like to inspect during development.

Mr Bean
  • 979
  • 1
  • 7
  • 17

3 Answers3

1

You can test your library code using RoboElectric that allows you to test without the need of deploying an android emulator.

Or you can set your library project as an Android library project and put the test in the first project. link

Community
  • 1
  • 1
Goofyahead
  • 5,874
  • 6
  • 29
  • 33
1

I guess you are asking about Android Library projects, otherwise you can just test your library using JUnit. In such case, the post android: testing library projects gives you a step by step guide on how to proceed to test the Android Library project in a stand-alone fashion. Think it can also be tested through the tests belonging to the Android project that uses the library.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
0

In latest android SDK tools you do not need to add jar in build path, they will be added automatically.

you can put you jar file in libs folder of your project, But it will defiantly be compile before running.

Mohsin Naeem
  • 12,542
  • 3
  • 39
  • 53