Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android使用Ant定制构建大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这4个文件(build.xml,local.properties,projects.properties,proguard.cfg)在运行时自动生成

但是我想要“auto-gen”build.xml也包含以下“预编译”代码,有没有办法呢?有没有包含“包含”文件或“模板”文件

<target name="config">

  <property name="config-target-path" value="${source.dir}/com/androidENGIneer/antbuild"/>

  <!-- Copy the configuration file,replacing tokens in the file. -->
  <copy file="config/Config.java" todir="${Config-target-path}"
        overwrite="true" encoding="utf-8">
   <filterset>
    <filter token="CONfig.LOGGING" value="${Config.logging}"/>
   </filterset>
  </copy>

 </target>

解决方法

android工具生成的build.xml(至少在使用Android SDK r20时)包含这段代码
<!--
    Import per project custom build rules if present at the root of the project.
    This is the place to put custom intermediary targets such as:
        -pre-build
        -pre-compile
        -post-compile (This is typically used for code obfuscation.
                       Compiled code LOCATIOn: ${out.classes.absolute.dir}
                       If this is not done in place,override ${out.dex.input.absolute.dir})
        -post-package
        -post-build
        -pre-clean
-->
<import file="custom_rules.xml" optional="true" />

那么我做什么来创建额外的目标或自定义现有的目标是创建一个具有这些新目标的custom_rules.xml文件.请注意,在我的测试中,目标需要嵌套在< project>标签,所以只需将生成的build.xml的前两行复制到custom_rules.xml,不要忘记关闭< / project>标签到底.由于custom_rules.xml不会被android更新覆盖,您的更改将会持续存在,并且可以检查您选择的SCM工具.

大佬总结

以上是大佬教程为你收集整理的Android使用Ant定制构建全部内容,希望文章能够帮你解决Android使用Ant定制构建所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。