Take a look at what you've been studying for the last two days-----in Windows one-click to complete the Android source code on the SVN and automatically package it.
Preparation: The Ant Pack Tool, the Android SDK, and a jar package Svnant.jar that the ant pull substitution code relies on, can be placed in the Lib directory under the ant directory.
Ant is a compilation tool for Apache, and my version is: apache-ant-1.9.4
The SDK does not introduce much.
Our Android developers can usually be packaged in eclipse, hit a package, finished after the end, but some scenarios this way is not suitable, such as I want to bulk packaging, or have dozens of or even hundreds of of items to package, it is obviously no longer in the original way to do.
Gossip less. We downloaded to ant extract and set the following bin directory as the system environment variable, so we can use ant in the cmd window:
Ant will find the Build.xml file in the current directory by default. If you want to select the specified file, you can use the ant-buildfile filename command.
Good. We started to configure the Build.xml,build.xml to do the main thing there are two pieces:
1, from the SVN pull replacement code;
2. Compile the code drawn to.
Let's look at a configuration file that Build.xml relies on: build.properties
Is the configuration of some variables.
Application information, SVN address, SVN username and password, apk generation path, finally we are in the current directory under the/PRODUCT/APK directory to fetch the package, the last line is the path of the SDK.
Now look at Build.xml.
<project Name= "Test" basedir= "." default= "Usage" >default define portal <property name= "RootDir" value= "." /><span style= "White-space:pre" ></span><pre name= "code" class= "HTML" ><span style= "color:# ff0000; " >svn Some of the things needed to replace the code </SPAN>
<property name= "Svnant.lib" value= "E:\work\ant\apache-ant-1.9.4\lib"/> <property name= "Svnant.jar" value= " ${svnant.lib}/svnant.jar "/> <property name=" Svnclientadapter.jar "value=" ${svnant.lib}/svnclientadapter.jar "/> <property name=" Svnjavahl.jar "value=" ${svnant.lib}/svnjavahl.jar "/> <property file=" Build.properties "/> The file affixed above <loadproperties srcfile=" Project.Properties "/> The Android project comes with a configuration file, pull the replacement code after automatically get, can also be placed in the current directory <target name= "usage" >build run the entrance <echo message= "Start Build"/> <antcall target= "Checkout"/ > Pull Replace code down </target><path id= "classpath" ><fileset dir= "${lib-dir}" includes= "***.jar"/></path >
<span style= "White-space:pre" ></SPAN>SVN configuration information <typedef resource= "org/tigris/subversion/svnant/ Svnantlib.xml "/><svnsetting id=" svn.setting "svnkit=" true "Username=" ${svn.user} "password=" ${svn.password} " Javahl= "false"/><span style= "White-space:pre" ></span><target name= "Checkout" ><SVN refid= " Svn.setting "><export srcurl=" ${urlrepos} "destpath=" ${rootdir} "force=" true "/> Configure SVN address user name and password </svn> <antcall target= "prepare"/> into preparation phase </target><fail message= "Sdk.dir is missing. Make sure to generate Local.properties using ' Android Update Project ' or to inject it through an env var "unless=" s Dk.dir "/> <import file=" ${sdk.dir}/tools/ant/build.xml "/><target name=" prepare "> Ready to compile, remove bin directory, Otherwise the compilation may not pass. <delete dir= "${rootdir}/bin"/><antcall target= "deploy"/> start compiling </target> <target name= "Deploy" &G T <antcall target= "release"/> Release package, this release target tool in the Android SDK directoryS/ant/build.xml directory <copy tofile= "${gos.path}/mangotravel_android.apk" > After the end of the copy to the target directory <fileset Dir= "${out.absolute.dir}/" includes= "mangotravel-release.apk"/> </copy><ec Ho message= "build finished"/> Packaging completed. </target> </project>Well, it's that simple, with a bat file, you can write three-character ant in the bat, you can double-click on it, or you can run ant in cmd.
If you need to hit a multi-channel package, you need to download another dependent jar package, Ant-contrib-1.0b3.jar, put the ant in the Lib directory, and then build.xml with the foreach tag in the loop to execute the name of the target to deploy, pay attention to the copy when the name is changed to the name of the channel, otherwise I do not know which channel the package corresponds to.
That's basically it. It is possible to compile some unexpected errors, but basically can be done through the error message, the problem is not big. For example, I started the time is mixed when the error, the later found that the Proguard version is too low, changed after the fix.
One click to complete Android from SVN pull to replace code codec pack