tools/ant
目录下有ant文件。在main_rules.xml
中,您可以找到以下代码段:<!-- Directory for the third party java libraries -->
<property name="jar.libs.dir" value="libs" />
<property name="jar.libs.absolute.dir" location="${jar.libs.dir}" />
<!-- create a path with all the jar files, from the main project and the
libraries -->
<path id="jar.libs.ref">
<fileset dir="${jar.libs.absolute.dir}" includes="*.jar" />
<path refid="project.libraries.jars" />
</path>
看起来新的 SDK 工具让这个过程更容易实现了。我有一个主库文件夹,所有的 Android 项目都共享它,并且我只需将其添加到 ant.properties
文件中,使其在上一级寻找那些库。
jar.libs.dir=../libs
custom_rules.xml
模板中,看起来运行良好。我想这只是比将路径添加到ant.properties
文件中多了几行代码,直到我们找到更好的解决方案。<target name="-pre-compile">
<path id="project.all.jars.path">
<path path="${toString:project.all.jars.path}"/>
<fileset dir="${jar.libs.dir}">
<include name="*.jar"/>
</fileset>
</path>
</target>
libs
中。Ant将正常工作。
编辑
请确保将所有符号链接直接放在libs
中(而不是子目录中)。我相信这可以通过ant脚本重新配置。但我不熟悉ant :-)
jar.libs.dir
的值,它显示为../libs
但是编译仍然失败。这是在SDK工具21.0.1上。 - Saad Farooq