0

I have setup an android test project for my application in ECLIPSE. My test project depends on some external libraries for Mock behavior.

I can add dependencies to my test project in following ways:

  1. If I put all the dependency jar files to my 'application\libs' folder, but they will be bundled with my application APK, irrespective of that my source does not depend on the these jars.

  2. If I put all the dependency jar files to my 'testProject\libs' folder, run test from ECLIPSE and success but logcat keeps givieng me warning of not finding classes. and i have read on SO that ant ingnores 'test\libs'? so is that the same case with ADT also.

So is it good practice to put external dependencies of test project in 'test\libs' only?

NOTE: In both the cases my test get run successfully But I am curious to get the right way.

Community
  • 1
  • 1
vijay_t
  • 776
  • 6
  • 14

1 Answers1

0

If you are adding external dependencies in android libs folder is most recommended. Just follow this following steps:

1.Create a folder called libs in your project's root folder.

2.Copy your JAR files to the libs folder.

3.Now right click on the Jar file and then select Build Path > Add to Build Path, which will create a folder called 'Referenced Libraries' within your project.

Third step gives reference to your libraries file.

Crawler
  • 1,988
  • 3
  • 21
  • 42
  • jars in libs folder are added automatically to build path. There is no need to add them to build path manually by 'Build Path > Add to'. – vijay_t Sep 09 '14 at 18:31
  • Its not for adding libraries to build path. Its for creating Reference Libraries. If you accidently move your libraries to another location, reference always keep them in track from your hard drive. – Crawler Sep 10 '14 at 04:53