简体   繁体   中英

Android test project fails to build under Ant, OK in Eclipse

I am trying to set up a CI build server for an Android app project and its JUnit test project. I've generated the appropriate build.xml files for both app and test projects.

Both projects build and execute fine under Eclipse.

However, when I try to do ant debug on the test project without having first built both projects with Eclipse, I get several [javac] errors saying error: cannot find symbol which refer to classes in the app project.

I think this is a difference between the classpath that Eclipse sees and the classpath that Ant is using...

How do I tell Ant where to find the app classes?

It seems the Android default build.xml defines all the targets, so I was wondering how to insert the appropriate reference in the app project's build.xml ... rather than having to start the build file from scratch.


  1. Tried exporting the Ant build file from Eclipse; that fails to build either project.

What seems to work is to re-run:

android update test-project -m ../../app_project/ -p .

within the test project.

The only change it made was to create an ant.properties file with one non-comment line:

tested.project.dir=../../app_project/

And now it all works swimmingly outside of Eclipse!

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