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

你说的曾经没有我的故事 提交于 2019-12-25 01:44:59

问题


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.

回答1:


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!



来源:https://stackoverflow.com/questions/17191807/android-test-project-fails-to-build-under-ant-ok-in-eclipse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!