你好,
我无法使用 ant 构建脚本编译我的项目。错误信息:
Ant cannot find symbol...
我阅读了有关创建 build.xml
的内容,但似乎还不够。我的项目目录具有以下布局:
项目
- 来源
- 创
- ...
libarie_with_needed_java.file
- 来源
- 客户
- 助手
如何使用外部引用? Ant 找不到 android jar
。 build.xml
文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
==================================================================== -->
<project name="test" default="main" basedir=".">
<!-- ====================================================================
Declare global properties for reuse and control of script
==================================================================== -->
<!-- For project source files -->
<property name="src.dir" location = "src/de/test"/>
<property name="common.link" location = "../test-common/common"/>
<!-- For compiled/output files. -->
<property name="build.dir" location = "build/source"/>
<!-- For class libraries and dependency files. -->
<property name="lib.dir" location = "lib"/>
<property name="sdk.dir" location = "../android-sdk-windows/" />
<!-- ====================================================================
Einstiegspunnkt - Target main
==================================================================== -->
<target name="main" depends="compile" description="getting started">
<echo message="start main target"/>
</target>
<!-- ====================================================================
Übersetzen - Target compile
==================================================================== -->
<target name="compile" depends="init">
<echo message="start compile target"/>
<javac srcdir="${src.dir}" destdir="${build}" debug="on"/>
<classpath refid="classpath"/>
</target>
<!-- ====================================================================
Initialisierungen - Target init
==================================================================== -->
<target name="init" description="create needed directories">
<echo message="start init target"/>
<mkdir dir="${build}"/>
</target>
</project>
我使用网站示例和 Eclipse 生成的文件创建了这个文件。
我删除了以下外部属性文件(以简化问题):
<property file="local.properties" />
<property file="build.properties" />
<property file="default.properties" />
我需要包含来自不同 src 位置的外部 .java 文件。
我需要知道如何复制项目中的外部文件并将所有内容编译在一起。
谢谢, 马塞尔
最佳答案
属性文件通常包含在整个主构建脚本中使用的变量值。
要找出为什么找不到 android.jar,请执行以下操作:
- 浏览到包含
build.xml
的目录。 - 向上浏览一个目录 (
../
)。 - 向下浏览到
android-sdk-windows/platforms/android-4/
。 - 确保
android.jar
位于该目录中。
否则,您必须将路径更改为 android.jar 相对于 build.xml
文件的位置。
关于android - Ant 构建脚本 : cannot find android. jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3083450/