简体   繁体   中英

Build Android Test Project using ANT script

I have a Android Project which is running fine on command line as well as using eclipse. So now I created the test project for the same, currently it is dependant on one external JAR. I kept this jar in libs/ directory. I can build and run the test project from command line.

Now the problem is that Eclipse is not able to recognize the JAR placed in libs directory and so eclipse is not able to build the project. I tried to modify build.properties file (setting the libs path in it), but that does not helped me.I don't want use properties ->JAVA build path -> Libraries -> Add external JARS in eclipse

Can some one tell the exact steps to build the test project with command line as well as with eclipse . Also, can I keep the JARs on another location than project directory ?

I don't want to use Maven

I encounter a similar problem with the following configuration:

MainProject
-src
 -...
-libs
  -ok.jar

TestProject
-src
 -testFiles

The ok.jar file is both needed by the MainProject and the TestProject

If I add the jar into TestProject/libs/ok.jar the build fail cause of class duplication. If I reference the MainProject/libs/ok.jar file threw external jar into the properties of the TestProject it does not work either.

I finally modified the properties of the MainProject to make it export the ok.jar file to other project by checking the combobox:

Project Properties -> Java Build Path -> Order and Export -> check the ok.jar file.

Last, the TestProject reference the MainProject as "Required projects on the build path".

Now the test project can see and use the ok.jar file.

It works fine threw eclipse and ant.

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