Eclipse can also compile Android apps, but Eclipse found that after the upgrade bundle too many things, a new project can not be compiled in the past, the review of resources will sometimes error, and large-scale application eclipse compiled is extremely slow, most of the case is basically compiled, but Eclipse is only suitable for editing code, not for compiling code. Today I specifically studied Ant and found it to be very simple, because Google has done too much for us.
One: First install ant, go to the Internet to find an ant package to download, extract to a directory, and then configure ant in the environment variable, enter Ant,cmd in cmd to recognize Ant is the installation success.
Second: The processing of the JDK, found whether it is jdk1.6 or 1.8, it is necessary to do a processing, you need to copy the JDK directory Lib/tools.jar to the JRE directory in the Lib, Ant run will pass.
Three: Install and understand the SDK version. How to install the SDK do not say, but it may be installed for a long time, do not know the version of the SDK, run the next SDK Android.bat, is the bat used to update the SDK, you can see which version you installed, if it is 4.4, the corresponding Android Level is 19, you need to remember this number.
Four: Write the Build.xml file, build the file under the root of the application to be compiled, and then follow the configuration below to compile it.
<?xml version= "1.0" encoding= "UTF-8"? ><project name= "Opengldemo_square" default= "release" > <!-- the directory where the SDK is located, the path must be correct-- <property name= "Sdk.dir" value= "E:\android-sdk_r22.3-windows"/> <!- -Introduce the build file that comes with the SDK--- <import file= "${sdk.dir}/tools/ant/build.xml"/> <!--specify the corresponding SDK version number, If Android 4.4 corresponds to 19. -- <property name= "target" value= "android-19"/></project>
What is the meaning of the line, there are notes, ant compilation is so simple, do not have to set what, the current discovery as long as the addition of the three lines on the line, if you need to specify the key, and then surf the Internet to check, add some properties can
Compiling Android apps with Ant