Set up APK timing Automatic Packaging System second article--Automatically upload files

Source: Internet
Author: User

The process of multi-channel packaging is described in the first--ant multi-channel packaging and specifying packaged catalogs and packaging dates for the APK timed automatic packaging system. Many times we need to upload the packaged apk to FTP, so I can modify custom_rules.xml this file to achieve this requirement.

1. Download the Common-net-3.3.jar and place it in the Lib folder under the Ant installation directory.

2. Modify the Ant.properties file

key.store=./test.keystorekey.alias=test.keystorekey.store.password=test12345key.alias.password=test12345# Generate Test.keystore#keytool-genkey-alias test.keystore-keyalg rsa-validity 20000-keystore test.keystoreapk.dir=. /apkapp.name=antdemo#channel numbersmarket_channels=myapp-12345,bai-3s322d

#upload apk

#ftp的主机地址, I configured an FTP server on this machine to test

ftp.hostname=127.0.0.1

#ftp登录帐号

Ftp.userid=admin

#登录密码

Ftp.password=6lg4lgct

#将apk文件存放ftp服务器中的根目录下, you can choose a different directory yourself

ftp.remotedir=/

The upload apk is followed by the newly added configuration properties, which are referenced in the Custom_rules.xml file and, of course, the Ftp.userid must have read and write permissions, or it will not be uploaded.

3. Modify the Custom_rules.xml file

<?xml version= "1.0" encoding= "UTF-8"? ><project name= "Custom_rules" > <taskdef resource= "net/sf/ Antcontrib/antcontrib.properties "> <classpath> <pathelement location=" ${ant. Ant_home}/lib/ant-contrib-1.0b3.jar "/> </classpath> </taskdef> <tstamp> <form At pattern= "yyyymmddhhmm" property= "Pktime" unit= "Hour"/> </tstamp> <m            Kdir dir= "${apk.dir}" > </mkdir> <target name= "Deploy" > <foreach delimiter= "," List= "${market_channels}" param= "Channel" target= "Modify_manifest" > </forea            ch> </target> <target name= "Modify_manifest" > <replaceregexp byline= "false" Flags= "G" > <regexp pattern= "android:value=" (. *) "android:name=" App_key ""/> <su Bstitution expression= "android:value=" ${channel}"Android:name=" App_key ""/> <fileset dir= "" includes= "Androidmanifest.xml" /> </replaceregexp> <property name= "Out.final.file" location= "${apk.dir}/ ${app.name}_${channel}_${pktime}.apk "/> <antcall target=" clean "/> <antcall target=" release "/&        Gt <antcall target= "Upload"/> </target>

<target

Name= "Upload"

description= "Upload apk to server ..." >

<ftp

Action= "Put"

binary= "Yes"

Passive= "true"

Password= "${ftp.password}"

Remotedir= "${ftp.remotedir}"

Separator= ""

Server= "${ftp.hostname}"

Userid= "${ftp.userid}"

Verbose= "Yes" >

<!--Specify the APK directory--

<fileset dir= "${apk.dir}" >

<include name= "${app.name}_${channel}_${pktime}.apk"/>

</fileset>

</ftp>

</target>

</project>

Add <antcall target= "upload" after <antcall target= "release"/> This is the upload task after packing.

Once modified, the Ant-deploy command can be executed to automatically package and upload to FTP.

4. Demo Code

Antdemo.rar

115 Network Tray Gift Pack code: 5LBDIIF2EH98

Http://115.com/lb/5lbdiif2eh98

This code contains multi-channel packaging and automatic upload FTP configuration, this code of FTP is a native test, run time need to configure an FTP address and read and write permissions of the user name and password

Set up APK timing Automatic Packaging System second article--Automatically upload files

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.