Archived: 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 file.

This tutorial was based on Android SDK R17 with Android 4.0.3 and left here as a reference.

Let me try to build the "debug" binary output first.

C:\>cd \herong\HelloAndroid
C:\herong\HelloAndroid>\local\apache-ant-1.8.3\bin\ant debug
Buildfile: C:\herong\HelloAndroid\build.xml

-set-mode-check:

-set-debug-files:

-set-debug-mode:

-debug-obfuscation-check:

-setup:
     [echo] Creating output directories if needed...
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\res
     [echo] Gathering info for HelloAndroid...
    [setup] Android SDK Tools Revision 17
    [setup] Project Target: Google APIs
    [setup] Vendor: Google Inc.
    [setup] Platform Version: 4.0.3
    [setup] API level: 15
    [setup]
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup]
    [setup] ------------------
    [setup] API<=15: Adding annotations.jar to the classpath.
    [setup]
    [setup] ------------------
    [setup] WARNING: No minSdkVersion value set. Application will
            install on all Android versions.

-build-setup:
    [mkdir] Created dir: C:\herong\HelloAndroid\gen
    [mkdir] Created dir: C:\herong\HelloAndroid\bin\classes

-pre-build:

-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 3 source files to
            C:\herong\HelloAndroid\bin\classes

-post-compile:

-obfuscate:

-dex:
      [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] Processing image to cache: C:\herong\HelloAndroid\res...
   [crunch]   (processed image to cache entry C:\herong\HelloAndr...
   [crunch] Processing image to cache: C:\herong\HelloAndroid\res...
   [crunch]   (processed image to cache entry C:\herong\HelloAndr...
   [crunch] Processing image to cache: C:\herong\HelloAndroid\res...
   [crunch]   (processed image to cache entry C:\herong\HelloAndr...
   [crunch] Crunched 3 PNG files to update cache

-package-resources:
     [aapt] Creating full resource package...

-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...

-post-package:

-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: C:\herong\HelloAndroid\bin\Hello
Android-debug.apk
[propertyfile] Creating new property file:
  C:\herong\HelloAndroid\bin\build.prop
[propertyfile] Updating property file:
  C:\herong\HelloAndroid\bin\build.prop

-post-build:

debug:

BUILD SUCCESSFUL
Total time: 7 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

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android 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

 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

 Archived: Downloading and Installing JDK 1.7

 Archived: Downloading and Installing Android SDK R17

 Archived: Running Android SDK Manager

 Archived: Installing Android Platform 4.0.3 and Libraries

 Archived: Verifying Android Platform Installation

 Archived: Creating Android Virtual Device (AVD)

 Archived: Launching Android Emulator in AVD Manager

 Archived: Android Emulator Built-in Applications

 Archived: Android Emulator Built-in Web Browser

 Archived: Downloading and Installing Apache Ant 1.8

 Archived: "HelloAndroid" - First Android Project

Archived: Building the Debug Binary Package

 Archived: Installing the Debug Binary Package

 Archived: Running the Debug Binary Package

 Archived: Rebuild the Debug Binary Package

 Archived: Redefine Text in Resource Files

 Archived: Installing Android PDF Viewer APK File

 Archived: Copy PDF File to Android Emulator's File System

 Archived: Installing Adobe Reader APK File

 Archived: "adb shell" - Remote Shell Interface

 Archived: "adb push" and "adb pull" Commands

 References

 Full Version in PDF/EPUB