Android ant Package and its environment variable configuration

Source: Internet
Author: User

Previously packaged items were packaged with blue shells or packaged in an eclipse-brought environment, or thrown directly to a third party to pack someone else (this is the Love encryption package). The next step is to take you into Ant's packaging age.

After each application is completed. Going to the market. On the market, there will be a lot of channels. There are a lot of channels. Means to hit a lot of channel packs. I'm going in a mile.

Remember there was a project. More than 100 channels. to the mercy. I can't get back to the plane. Android is such a cock wire. Not like iOS Gaofu. Just a few dozen.
it used to be that ant automated channel packaging is complex. In fact, it is not difficult to say difficult. It is not complicated to say complex. The most is to configure the environment. The environment is well equipped. The configuration in the generated Build.xml is ready.
you can basically pack it up.
A. The first thing to do is to configure the Java environment of the computer to the environment variable in path. People who don't understand can refer to http://blog.csdn.net/huanghm88/article/details/3965218 reprint
Two, the Android SDK is also configured to the environment variables in the path of people who do not understand can refer to http://jingyan.baidu.com/article/17bd8e52f514d985ab2bb800.html reprint
three. Download the ant Environment Pack. The address is downloaded in http://ant.apache.org/manualdownload.cgi. Remember also configured to the environment variable in path, my address is such D:\apache-ant-1.9.2\bin; specifically, you set up, configure the successful click to run. Enter CMD. Enter Ant-version carriage return
indicates that the configuration was successful.
four, using ant, Generate Build.xml file for project to view http://www.xmumu.com/post/2011-11-22/7022215 reprint.
If you say that the order is not coming out. Or if you can't find it. Indicates a problem with the Android SDK environment configuration. To be configured well. Online Search under
Five, if the Build.xml and other files are generated in the project. Can be configured for the next step, such as directory
The ant.properties file is a file that we want to create ourselves. is to introduce to you later. The other two files are build.xml and local.properties
for ant packaging, you can look at these two articles first http://www.cnblogs.com/MrShi/archive/2013/04/16/3023311.html,http://www.cnblogs.com/ mrshi/archive/2013/04/16/3023485.html Reprint
Six, let's introduce the contents of the next Ant.properties .

one of the proguard.config=proguard.cfg is confusing files. I believe we all know how to define a confusing file.
Key.store=e:\\androidkey.keystore is the absolute address of the signature file. I am the window system here. So write this. L
Key.alias=androidkevin.keystore The alias of the signature file. If you forget the words. You can use Eclipse to package the last time you enter a password. There's an alias that's your nickname.
key.store.password=123455 Signature Password
key.alias.password=123455 Signature Password
Market_channels A list of packaged channels. separated by commas. Don't know the words in front of two articles are explained

Here's what I got out of my build.xml file:
<?xml version= "1.0" encoding= "UTF-8"? ><project name= "Babyrecord" default= "release" > <property file= " Local.properties "/> <property file=" ant.properties "/> <property environment=" env "/> <conditi On property= "Sdk.dir" value= "${env. Android_home} "> <isset property=" env. Android_home "/> </condition> <property name=" OutDir "value=" bin "/> <property name=" outdir-cl Asses "value=" ${outdir}/classes "/> <property name=" proguard-home "value=" d:\\proguard4.2\\lib\\ "/> <p     Roperty name= "Sdk-folder" value= "D:\android-sdk_r16-windows\android-sdk_r16-windows\android-sdk-windows"/> <property name= "Android-jar" value= "${sdk-folder}\platforms\android-3\android.jar"/> <loadproperties srcfile= "Project.Properties"/> <fail message= "Sdk.dir is missing. Make sure to generate Local.properties using ' Android Update Project ' or to inject it through the android_home environment variable. " unless= "Sdk.dir"/> <import file= "Custom_rules.xml" optional= "true"/> <import file= "${sdk.dir}/tools  /ant/build.xml "/> <property name=" Out.unaligned.dir "value=" f:\babyrecord_${app_version}\ "/> <mkdir Dir= "${out.unaligned.dir}"/> <target name= "Modify_update_file" > <echo>****************** Make channel ${channel}</echo> <replaceregexp file= "Androidmanifest.xml" Match= ' C Hannel ' replace= ' ${channel} ' byline= "false" encoding= "Utf-8"/> <prop Erty name= "Out.unaligned.file" location= "${out.unaligned.dir}\babyrecord_${app_version}_release_build${app_date}  _${channel}.apk "/> <antcall target=" release "/> </target> <target name=" Make_one_channels " depends= "Savemanifest,modify_update_file,release,replacemanifest,deletebin" description= "description" > </ Target> <target name= "replacemanifest" > <echo>*********************** replacemanifest</echo> <delete file= "${basedir}\androidmanifest.xml"/> <copy file= ". \temp\build\meta-inf\androidmanifest.xml "todir=" ${basedir} "encoding=" Utf-8 "/> </target> <target name= "Savemanifest" > <echo>*********************** savemanifest</echo> <copy file= "${basedir}\A Ndroidmanifest.xml "Todir=". \temp\build\meta-inf "encoding=" Utf-8 "/> </target> <target name=" Deletebin "> <delete dir=" ${basedir}\bin\* "/> </target> <taskdef name=" foreach "Classname=" Net.sf.antcontrib.logic.ForEach "class    Path= "D:\android-sdk_r16-windows\android-sdk_r16-windows\android-sdk-windows\tools\ant-contrib-1.0b3.jar"/> <target name= "Make_channels" > <foreach target= "make_one_channels" list= "${market_channels}" delimiter= "," Param= "Channel" > &LT;/FOReach> </target></project> 


everyone sees the variable env inside. Android_home not. Here is the configuration name used by us before Java in the computer environment variable. So everyone in the configuration time. To start with a new one. Name is Android_home
configure it to be the address of the Android SDK for other configurations. Everyone knew it at the first glance. Some of them are their own folder addresses. Some are configured in Ant.properties. If you encounter an error. Can leave a message to reply to me. I will try to help you answer

Android ant Package and its environment variable configuration

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.