Building the Debug Binary Package

This section provides a tutorial example on how to build the debug binary package of the HelloAndroid application using the Apache Ant tool and the build.xml file.

After reinstalling "Android SDK Tools 24.3.3" and "Android SDK Build-tools 22.0.1" with Android SDK Manager, I tried the "ant debug" command again. It worked this time:

C:\>cd \herong\HelloAndroid

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

Buildfile: C:\herong\HelloAndroid\build.xml



 [checkenv] Android SDK Tools Revision 24.3.3
 [checkenv] Installed at C:\local\android-sdk-windows

     [echo] Project Name: HelloAndroid
  [gettype] Project Type: Application




[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
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\res
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\rsObj
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\rsLibs
    [mkdir] Created dir: C:\herong\HelloAndroid\gen
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\classes

    [mkdir] Created dir: C:\herong\HelloAndroid\bin\dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for HelloAndroid...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

[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] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.


    [javac] Compiling 3 source files to
    [javac] warning: [options] source value 1.5 is obsolete and will
       be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete
       options, use -Xlint:-options.
    [javac] 3 warnings



      [dex] input: C:\herong\HelloAndroid\bin\classes
      [dex] Converting compiled files and external libraries into

   [crunch] Crunching PNG Files in source dir:
   [crunch] To destination dir: C:\herong\HelloAndroid\bin\res
   [crunch] Processing image to cache:
      => C:\herong\HelloAndroid\bin\res\drawable-hdpi\ic_launcher.png
   [crunch]   (processed image to cache entry
      87% size of source)
   [crunch] Crunched 4 PNG files to update cache

     [aapt] Creating full resource package...

[apkbuilder] Current build type is different than previous build:
   forced apkbuilder run.
[apkbuilder] Creating HelloAndroid-debug-unaligned.apk and signing it
   with a debug key...


 [zipalign] Running zip align on final apk...
     [echo] Debug Package:
[propertyfile] Creating new property file:
[propertyfile] Updating property file:



Total time: 2 seconds

By looking at the output, I think my HelloAndroid binary package, HelloAndroid-debug-unaligned.apk, is ready to be tested on the Android emulator.

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

 Creating Android Project with "android" Command

 Listing Target Android Platforms

 "HelloAndroid" - First Android Project

 "" - First Android Java Code

 "ant debug" Command and Build Error

Building the Debug Binary Package

 Installing the Debug Binary Package

 Running the Debug Binary Package

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 AboutAndroid - Application to Retrieve System Information Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

 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

 Archived Tutorials


 Full Version in PDF/EPUB