Ant compiled and packaged Android engineering process

Source: Internet
Author: User

First, Ant compiled and packaged Android engineering steps


Two, Ant apk signature 1.keystore Signature definition own signature file generated KeyStore file: Keytool-genkey-alias android.keystore-keyalg rsa-validity 20000-key Store Android.keystore
Corresponding Java command: Jarsigner-verbose-keystore android.keystore-signedjar android_signed.apk android.apk
The corresponding ant script command:
<target name= "sign" ><echo>begin sign unobfuscated package...</echo><exec executable= "${signer} "Failonerror=" true "><arg value="-verbose "/><arg value="-keystore "/><arg value=" ${keystore} "/ ><arg value= "-storepass"/><arg value= "${store_pass}"/><arg value= "-keypass"/><arg value= "$ {Key_pass} "/><arg value="-signedjar "/><arg value=" ${temp}\${file_name}_unobfs_signed.apk "/>< Arg value= "${temp}\${file_name}_unobfs.apk"/><arg value= "${key_name}"/></exec></target>

<property name= "KeyStore" value= "${project_path}\pada_keystore_formal"/><!--signed key name Settings--><property Name= "Key_name" value= "Padaapp"/><!--signed password settings--><property name= "Key_pass" value= "Padaeaglenet"/> <!--signed password settings--><property name= "Store_pass" value= "Padaeaglenet"/>

2. System signature (PLATFORM.PK8, PLATFORM.X509.PEM) Some applications require system signatures, such as defining shareduserid= "Android.uid.system". System signature File: Platform.pk8, Platform.x509.pem
Storage directory: build/target/product/security/corresponding java command: Java-jar signapk.jar PLATFORM.X509.PEM platform.pk8 app_unsigned.apk app_signed.apk
The corresponding ant script command:
<exec executable= "java" failonerror= "true" >            <arg value= "-jar"/> <arg value=            "${project.dir}/ Stbsign/signapk.jar "/>            <arg value=" ${project.dir}/stbsign/platform.x509.pem "/> <arg            value=" $ {project.dir}/stbsign/platform.pk8 "/>            <arg value=" ${buildtemp.dir}/unsigntest.apk "/>            <arg Value= "${buildtemp.dir}/tvjusign.apk"/>        


Three, Ant apk multi-channel packaging the current mainstream multi-channel packaging method is to add a channel metadata node under application in Androidmanifest.xml. For example, to make the UF league statistics, it configures Androidmanifest.xml to add the following code:

<meta-data
Android:name= "Umeng_channel"
Android:value= "Channelcode"/>

To replace the value of Channelcode with an automated method, you can use a regular expression with the following code:

<target name= "Alter_umeng_channel" >
<property name= "Umeng_channel" value= "${public_umeng_channel}"/><echo> alter_umeng_channle_id ... "${umeng_channel}" </echo> <replaceregexp file= "${auto.project.tmp.dir}/androidmanifest.xml"           match= " <meta\-data (\s+) android:name= "Umeng_channel" (\s+) android:value= "[a-za-z0-9]+" "           replace=" <meta\-data Android:name= "Umeng_channel" android:value= "${umeng_channel}" "        /></target>




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.