Ant 批量打包Android Umeng多渠道版本
2015-01-01 00:25
351 查看
先决条件:
apache ant
具体步骤:
在 AndroidManifest.xml 中添加meta-data 标签:
生成ant build.xml
android update project -p [project_path]
在ant.properties文件中添加如下配置
在build.xml中添加如下代码
apache ant
antcontrib
具体步骤:
在 AndroidManifest.xml 中添加meta-data 标签:
<meta-data android:name="UMENG_CHANNEL" android:value="10086" > </meta-data>
生成ant build.xml
android update project -p [project_path]
在ant.properties文件中添加如下配置
application.package=com.sage.jiecai ant.project.name=jiecai java.encoding=utf-8 proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt key.store=sign/android.keystore key.store.password=storepassword key.alias=jiecai key.alias.password=aliaspassword version=1.0 market_channels=51jiecai,360,qq,hiapk,baidu,91,wandoujia,xiaomi,10086
在build.xml中添加如下代码
<property file="ant.properties"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"> <classpath> <pathelement location="/Library/ant/lib/ant-contrib-1.0b3.jar"/> </classpath> </taskdef> <import file="${sdk.dir}/tools/ant/build.xml"/> <target name="deploy"> <foreach target="modify_manifest" list="${market_channels}" param="channel" delimiter=","> </foreach> </target> <target name="modify_manifest"> <echo message="===========================${channel}========================="/> <replaceregexp flags="g" byline="false"> <!-- 匹配的内容是 android:value="*****" android:name="UMENG_CHANNEL" --> <regexp pattern='android:name="UMENG_CHANNEL" android:value="(.*)"'/> <!-- 匹配之后将其替换为 android:value="渠道名" android:name="UMENG_CHANNEL" --> <substitution expression='android:name="UMENG_CHANNEL" android:value="${channel}"'/> <!-- 正则表达式需要匹配的文件为AndroidManifest.xml --> <fileset dir="" includes="AndroidManifest.xml"/> </replaceregexp> <echo message="===========================${channel}========================="/> <property name="out.release.file" location="${out.absolute.dir}/${ant.project.name}_${channel}.apk"/> <!--包 --> <antcall target="release"/> <!--输出渠道包到bin/out目录下 --> <copy tofile="${out.absolute.dir}/out/${ant.project.name}_v${version}-${channel}.apk" file="bin/${ant.project.name}-release.apk"/> <echo message="===========================end============================="/> </target>
相关文章推荐
- android Ant 批量多渠道打包
- android Ant 批量多渠道打包 总结!
- Android中利用ant进行多渠道循环批量打包(一)
- android ant多渠道 批量打包 打包过程及过程中遇到问题
- Android中利用ant进行多渠道循环批量打包
- linux(以ubuntu为例)下Android利用ant自动编译、修改配置文件、批量多渠道,打包生成apk文件
- Android中利用ant进行多渠道循环批量打包(二)
- windows下Android利用ant自动编译、修改配置文件、批量多渠道,打包生成apk文件
- android ant 多渠道批量打包
- Android中利用ant进行多渠道循环批量打包(二)
- Android中利用ant进行多渠道循环批量打包(一)
- Android中利用ant进行多渠道循环批量打包
- Android中利用ant进行多渠道循环批量打包(二)
- Android中利用ant进行多渠道循环批量打包(二)
- android ant 多渠道批量打包
- Android Ant 批量多渠道打包实例
- android ant 多渠道批量打包
- android Ant 批量多渠道打包!
- Android中利用ant进行多渠道循环批量打包(一)
- Android Ant 批量多渠道打包实例