Prerequisite:
- Apache Ant
Antcontrib
Specific steps:
- In? Add Meta-data tags in androidmanifest.xml:
Android : Name android: Value>
</meta-data>
- Build Ant Build.xml
Android update project?-p? [Project_path]
- Add the following configuration in the Ant.properties file
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
- Add the following code in the Build.xml
file =" ant.properties " />
<taskdefResource= "Net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement Location= "/library/ant/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<importfile= "${sdk.dir}/tools/ant/build.xml"/>
<targetname= "Deploy">
<foreachTarget= "Modify_manifest"List= "${market_channels}"param= "Channel"delimiter=",">
</foreach>
</target>
<targetname= "Modify_manifest">
<echomessage= "===========================${channel}========================="/>
<replaceregexpFlags= "G"byline= "false">
?<!--matches is android:value= "* * * * *" android:name= "Umeng_channel"-
?<regexppattern= ' android:name= ' Umeng_channel "android:value=" (. *) "'/>
?<!--match and replace it with android:value= "channel name" Android:name= "Umeng_channel"-
?<substitutionexpression= ' android:name= ' Umeng_channel "android:value=" ${channel} "'/>
?<!--regular expressions require matching files of Androidmanifest.xml--
?<filesetdir="" includes= "Androidmanifest.xml"/>
</replaceregexp>
<echomessage= "===========================${channel}========================="/>
<propertyname= "Out.release.file" Location= "${out.absolute.dir}/${ant.project.name}_${channel}.apk"/>
?<!--Pack--
?<antcallTarget= "Release"/>
?<!--output channel package to bin/out directory--
?<copyToFile= "${out.absolute.dir}/out/${ant.project.name}_v${version}-${channel}.apk"
?file= "bin/${ant.project.name}-release.apk"/>
<echomessage= "===========================end============================="/>
</target>
?
Ant Bulk pack Android Umeng multichannel version