在sdk中,有蚂蚁文件tools/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>
Run Code Online (Sandbox Code Playgroud)
这就是ant构建代码决定从哪里获取jar的方式.您可以重载jar.libs.dirbuild.properties中的值,因为在本节之前读取了该值并且会使值重载.指出您打算使用的公共目录将执行您的建议.您可能需要使用它来使其按您想要的方式工作.
需要注意的是,我不确定这是否会对其他构建生命周期活动产生负面影响.
看起来新的sdk工具使这更容易实现.我有一个主libs文件夹,我所有的android项目共享,我只是将其添加到ant.properties文件中,使其查找这些库的一个级别.
jar.libs.dir=../libs
Run Code Online (Sandbox Code Playgroud)