Android Tutorials - Herong's Tutorial Examples - v3.05, by Herong Yang
Project Build Process Done by "ant debug" Command
This section describes the Android project build process done by the 'ant debug' command defined in the Ant build file. It performs 'aidl', 'aapt', 'javac', 'dex', 'apkbuilder' and 'zipalign' all together automatically.
With the use of Ant build file, those 7 project build steps are all performed automatically by a single Ant task, "debug" or "release", defined in the build file. Let's exam the "ant debug" output on the "HelloAndroid" project to see how those build steps are performed:
C:\herong\HelloAndroid>\local\apache-ant-1.9.5\bin\ant debug Buildfile: C:\herong\HelloAndroid\build.xml -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 24.3.3 [checkenv] Installed at C:\local\android-sdk-windows -setup: [echo] Project Name: HelloAndroid [gettype] Project Type: Application -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] Using latest Build Tools: 22.0.1 [echo] Resolving Build Target for HelloAndroid... [gettarget] Project Target: Android 5.1.1 [gettarget] API level: 22 [gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions. [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: C:\herong\HelloAndroid\bin\rsObj [mkdir] Created dir: C:\herong\HelloAndroid\bin\rsLibs [echo] ---------- [echo] Resolving Dependencies for HelloAndroid... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ [echo] ---------- [echo] Building Libraries with 'debug'... [subant] No sub-builds to iterate on -code-gen: [mergemanifest] Found Deleted Target File [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... [aapt] Found Deleted Target File [aapt] Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] No need to generate new BuildConfig. -pre-compile: -compile: [javac] Compiling 1 source file to C:\herong\HelloAndroid\bin\classes -post-compile: -obfuscate: -dex: [dex] input: C:\herong\HelloAndroid\bin\classes [dex] Found Deleted Target File [dex] Converting compiled files and external libraries into C:\herong\HelloAndroid\bin\classes.dex... -crunch: [crunch] Crunching PNG Files in source dir: C:\herong\HelloAndroid\res [crunch] To destination dir: C:\herong\HelloAndroid\bin\res [crunch] Crunched 0 PNG files to update cache -package-resources: [aapt] Found Deleted Target File [aapt] Creating full resource package... -package: [apkbuilder] Found Deleted Target File [apkbuilder] Creating HelloAndroid-debug-unaligned.apk and signing it with a debug key... -post-package: -do-debug: [zipalign] Running zip align on final apk... [echo] Debug Package: C:\herong\\HelloAndroid\bin\HelloAndroid-debug.apk [propertyfile] Updating property file: C:\herong\HelloAndroid\bin\build.prop -post-build: debug: BUILD SUCCESSFUL Total time: 5 seconds
Here is what I see in the output:
Table of Contents
Installing JDK 1.8 on Windows System
Installation of Android SDK R24 and Emulator
Installing Apache Ant 1.9 on Windows System
Developing First Android Application - HelloAndroid
Android Application Package (APK) Files
Android Debug Bridge (adb) Tool
AboutAndroid - Application to Retrieve System Information
android.app.Activity Class and Activity Lifecycle
View Objects and Layout Resource Files
Using "adb logcat" Command for Debugging
►Build Process and Package File Content
"android create project" Command Options
Android Project Folder Structure
Android Application Project Build Process
►Project Build Process Done by "ant debug" Command
Detailed Output of "ant -verbose debug" Command
Output of "ant -verbose debug" - Android SDK R17
"aapt" - Android Asset Packaging Tool
"aapt package" Command - Resource Code Generation
"javac" - Java Compilation Command
"dx.bat --dex" Command - Converting .class Files into .dex File
"apkbuilder" Command - Packaging and Signing .apk File
"zipalign" Command - Aligning File Locations in .apk Package
"aapt dump" Command - Printing Contents of .apk Package
META-INF Files - Digests, Signature and Certificate
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
USB Debugging Applications on LG-V905R Tablet