Art*_*902 5 java eclipse ant android
我正在和Ant一起做一些汽车品牌推广工作.我修改了默认的build.xml并设置了我自己的目标.我希望问的是,在Ant脚本中是否有一种方法可以自动重命名apk文件,只需使用特定名称构建?
我目前在build.xml中有这个Ant目标设置:
<target name="release-brandA"
depends="default, -set-release-mode, -release-obfuscation-check, -package, -post-package, -release-prompt-for-password, -release-nosign, -release-sign, -post-build"
description="Builds the application in release mode for brandA.">
<delete dir="${res}" />
<copydir dest="${res}" src="${branding}/brandA" forceoverwrite="ture" />
<replaceregexp flags="g" byline="false">
<regexp pattern="import com.arthur.android(.*).R;"/>
<substitution expression="import com.arthur.android.brandA.R;"/>
<fileset dir="src" includes="**/*.java" />
</replaceregexp>
<replaceregexp flags="g" byline="false">
<regexp pattern="package="com.arthur.android(.*)"" />
<substitution expression="package="com.arthur.android.brandA"" />
<fileset dir="" includes="AndroidManifest.xml" />
</replaceregexp>
</target>
Run Code Online (Sandbox Code Playgroud)
有没有办法可以添加更多任务,让输出文件就像brandA.apk?
谢谢!
azg*_*fer 10
最终的apk文件名实际上由属性'out.final.file'定义
因此,您可以创建一个设置此属性的新任务:
<target name="-set-out-final-file">
<property name="out.final.file" location="${out.absolute.dir}/brandA.apk" />
</target>
Run Code Online (Sandbox Code Playgroud)
最后,您只需-set-out-final-file在调用调试或释放目标之前调用目标.
使用您的release-brandA任务,它将成为这样:
<target name="release-brandA"
depends="default, -set-out-final-file, -set-release-mode, -release-obfuscation-check...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3472 次 |
| 最近记录: |