[英]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. 我正在尝试为Android应用程序项目及其JUnit测试项目设置CI构建服务器。 I've generated the appropriate
build.xml
files for both app and test projects. 我已经为应用程序和测试项目生成了适当的
build.xml
文件。
Both projects build and execute fine under Eclipse. 这两个项目都可以在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. 但是,当我尝试不首先使用Eclipse构建两个项目而在测试项目上进行
ant debug
时,会出现几个[javac]
错误,提示error: cannot find symbol
在应用程序项目中引用类的error: cannot find symbol
。
I think this is a difference between the classpath that Eclipse sees and the classpath that Ant is using... 我认为这是Eclipse看到的类路径与Ant正在使用的类路径之间的区别...
How do I tell Ant where to find the app classes? 如何告诉Ant在哪里可以找到应用程序类?
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. 似乎Android默认的
build.xml
定义了所有目标,因此我想知道如何在应用程序项目的build.xml
插入适当的引用...而不是从头开始构建文件。
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: 所做的唯一更改是使用一个非注释行创建了一个
ant.properties
文件:
tested.project.dir=../../app_project/
And now it all works swimmingly outside of Eclipse! 现在,所有这些都可以在Eclipse之外畅游!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.