Android Tutorials - Herong's Tutorial Examples - Version 3.00, by Dr. Herong Yang

Detailed Output of "ant -verbose debug" Command

This section describes the output of the 'ant -verbose debug' command, which provides more details how each of 'aidl', 'aapt', 'javac', 'dex', 'apkbuilder' and 'zipalign' tools are invoked in the Ant build process.

Looking at the default output of the "ant debug" command, we get the idea of what development tools are used in the Ant build file to finish the full build process of an Android project. But if you want to know how those tools are invoked, you need to use the "-verbose" option to see more details.

Let's remove all files generated by the previous build process and run "ant -verbose debug" command on the HelloAndroid project:

C:\herong\HelloAndroid>\local\apache-ant-1.9.5\bin\ant all clean

C:\herong\HelloAndroid>\local\apache-ant-1.9.5\bin\ant -verbose debug

Apache Ant(TM) version 1.9.5 compiled on May 31 2015
Trying the default build file: build.xml
Buildfile: C:\herong\HelloAndroid\build.xml
Detected Java version: 1.8 in: C:\Program Files\Java\jdk1.8.0_45\jre
Detected OS: Windows 7
parsing buildfile C:\herong\HelloAndroid\build.xml with 
   URI = file:/C:/herong//HelloAndroid/build.xml
Project base dir set to: C:\herong\HelloAndroid
parsing buildfile jar:file:/C:/local/apache-ant-1.9.5/lib/ant.jar...
 [property] Loading C:\herong\HelloAndroid\local.properties
 [property] Loading C:\herong\HelloAndroid\ant.properties
 [property] Loading Environment env.
Property "env.ANDROID_HOME" has not been set
Importing file C:\herong\HelloAndroid\custom_rules.xml 
   from C:\herong\HelloAndroid\build.xml
Cannot find C:\herong\HelloAndroid\custom_rules.xml imported 
   from C:\herong\HelloAndroid\build.xml
Importing file C:\local\android-sdk-windows\tools\ant\build.xml 
   from C:\herong\HelloAndroid\build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\local\android-sdk-windows\tools\ant\build.xml 
   with URI = file:/C:/local/android-sdk-windows/tools/ant/build.xml
Property "key.store" has not been set
 [macrodef] creating macro  do-only-if-not-library
 [macrodef] creating macro  do-only-if-manifest-hasCode
 [macrodef] creating macro  dex-helper
 [macrodef] creating macro  package-helper
 [macrodef] creating macro  zipalign-helper
 [macrodef] creating macro  run-tests-helper
 [macrodef] creating macro  record-build-key
 [macrodef] creating macro  record-build-info
 [macrodef] creating macro  uninstall-helper
Overriding previous definition of reference to ant.projectHelper
Build sequence for target(s) `debug' is [-set-mode-check, -set-d...
Complete build sequence is [-set-mode-check, -set-debug-files, -...

-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:
Property "emma.enabled" has not been set

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 22.0.1
 [property] Loading C:\herong\HelloAndroid\bin\build.prop
Override ignored for property "build.last.target"
Override ignored for property "build.last.is.instrumented"
Override ignored for property "build.last.is.packaging.debug"
Override ignored for property "build.last.is.signing.debug"
     [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] Skipping C:\herong\HelloAndroid\res because it already ...
    [mkdir] Skipping C:\herong\HelloAndroid\libs because it already...
    [mkdir] Skipping C:\herong\HelloAndroid\bin because it already ...
    [mkdir] Skipping C:\herong\HelloAndroid\bin\res because it alre...
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\rsObj
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\rsLibs
    [mkdir] Skipping C:\herong\HelloAndroid\gen because it already ...
    [mkdir] Skipping C:\herong\HelloAndroid\bin\classes because it ...
    [mkdir] Skipping C:\herong\HelloAndroid\bin\dexedLibs because i...
     [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...
Property "android.library" has not been set
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [aapt] Current OS is Windows 7
     [aapt] Executing 
'C:\local\android-sdk-windows\build-tools\22.0.1\aapt.exe' 
with arguments:
     [aapt] 'package'
     [aapt] '-f'
     [aapt] '-m'
     [aapt] '-0'
     [aapt] 'apk'
     [aapt] '-M'
     [aapt] 'C:\herong\HelloAndroid\bin\AndroidManifest.xml'
     [aapt] '-S'
     [aapt] 'C:\herong\HelloAndroid\bin\res'
     [aapt] '-S'
     [aapt] 'C:\herong\HelloAndroid\res'
     [aapt] '-I'
[aapt] 'C:\local\android-sdk-windows\platforms\android-22\android.jar'
     [aapt] '-J'
     [aapt] 'C:\herong\HelloAndroid\gen'
     [aapt] '--generate-dependencies'
     [aapt] '-G'
     [aapt] 'C:\herong\HelloAndroid\bin\proguard.txt'
     [aapt] 
     [aapt] The ' characters around the executable and arguments are
     [aapt] not part of the command.
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
    [javac] com\herongyang\HelloAndroid.java omitted as 
C:\herong\HelloAndroid\bin\classes\com\herongyang\HelloAndroid.cla...
    [javac] C:\herong\HelloAndroid\gen\R.java.d skipped - don't kn...
    [javac] com\herongyang\BuildConfig.java omitted as
C:\herong\HelloAndroid\bin\classes\com\herongyang\BuildConfig.clas...
    [javac] com\herongyang\R.java added as com\herongyang\R.class ...
[javac] Compiling 1 source file to C:\herong\HelloAndroid\bin\classes
    [javac] Using modern compiler
    [javac] Compilation arguments:
    [javac] '-d'
    [javac] 'C:\herong\HelloAndroid\bin\classes'
    [javac] '-classpath'
    [javac] 'C:\herong\HelloAndroid\bin\classes'
    [javac] '-sourcepath'
    [javac] 'C:\herong\HelloAndroid\src;C:\herong\HelloAndroid\gen'
    [javac] '-target'
    [javac] '1.5'
    [javac] '-bootclasspath'
[javac] 'C:\local\android-sdk-windows\platforms\android-22\android.jar'
    [javac] '-encoding'
    [javac] 'UTF-8'
    [javac] '-g'
    [javac] '-source'
    [javac] '1.5'
    [javac] 
    [javac] The ' characters around the executable and arguments are
    [javac] not part of the command.
    [javac] File to be compiled:
    [javac]     C:\herong\HelloAndroid\gen\com\herongyang\R.java

-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...
       [dx] Current OS is Windows 7
       [dx] Executing 
'C:\local\android-sdk-windows\build-tools\22.0.1\dx.bat' 
with arguments:
       [dx] '--dex'
       [dx] '--output'
       [dx] 'C:\herong\HelloAndroid\bin\classes.dex'
       [dx] 'C:\herong\HelloAndroid\bin\classes'
       [dx] 
       [dx] The ' characters around the executable and arguments are
       [dx] not part of the command.

-crunch:
   [crunch] Current OS is Windows 7
   [crunch] Executing 
'C:\local\android-sdk-windows\build-tools\22.0.1\aapt.exe'
with arguments:
   [crunch] 'crunch'
   [crunch] '-v'
   [crunch] '-S'
   [crunch] 'C:\herong\HelloAndroid\res'
   [crunch] '-C'
   [crunch] 'C:\herong\HelloAndroid\bin\res'
   [crunch] 
   [crunch] The ' characters around the executable and arguments are
   [crunch] not part of the command.
   [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...
     [aapt] Current OS is Windows 7
     [aapt] Executing 
'C:\local\android-sdk-windows\build-tools\22.0.1\aapt.exe' 
with arguments:
     [aapt] 'package'
     [aapt] '--no-crunch'
     [aapt] '-f'
     [aapt] '--debug-mode'
     [aapt] '-0'
     [aapt] 'apk'
     [aapt] '-M'
     [aapt] 'C:\herong\HelloAndroid\bin\AndroidManifest.xml'
     [aapt] '-S'
     [aapt] 'C:\herong\HelloAndroid\bin\res'
     [aapt] '-S'
     [aapt] 'C:\herong\HelloAndroid\res'
     [aapt] '-I'
[aapt] 'C:\local\android-sdk-windows\platforms\android-22\android.jar'
     [aapt] '-F'
     [aapt] 'C:\herong\HelloAndroid\bin\HelloAndroid.ap_'
     [aapt] '--generate-dependencies'
     [aapt] 
     [aapt] The ' characters around the executable and arguments are
     [aapt] not part of the command.

-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...
[zip-align] Current OS is Windows 7
[zip-align] Executing 
'C:\local\android-sdk-windows\build-tools\22.0.1\zipalign.exe' 
with arguments:
[zip-align] '-f'
[zip-align] '4'
[zip-align] 
'C:\herong\HelloAndroid\bin\HelloAndroid-debug-unaligned.apk'
[zip-align] 'C:\herong\HelloAndroid\bin\HelloAndroid-debug.apk'
[zip-align] 
[zip-align] The ' characters around the executable and arguments are
[zip-align] not part of the command.
     [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: 2 seconds

Wow! I can see more useful information in the output now:

  • "aapt package" command is used in the resource code generation step. Command options and arguments are clearly printed out in the output. We can actually try it ourself without use "ant".
  • Command options and arguments of "javac" command are also printed in the output for the Java compilation step.
  • The "dex" tool is actually invoked from the dx.bat batch file for the byte code conversion step.
  • The "aapt crunch" tool is actually used in the packaging step.
  • There are no details about the "apkbuilder" in package signing step.
  • Command options and arguments of "zipalign" command are also printed in the output for the package optimization step.

Last update: 2015.

Table of Contents

 About This Book

 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

 Android File Systems

 Android 4.0.3 File Systems

 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

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Outdated Tutorials

 References

 PDF Printing Version

Build Process and Package File Content - Updated in 2015, by Dr. Herong Yang