Android Tutorials - Herong's Tutorial Examples - v3.05, by Herong Yang
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 -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 [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] [dependency] ------------------ [echo] ---------- [echo] Building Libraries with 'debug'... [subant] No sub-builds to iterate on -code-gen: [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. -pre-compile: -compile: [javac] Compiling 3 source files to C:\herong\HelloAndroid\bin\classes [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 -post-compile: -obfuscate: -dex: [dex] input: C:\herong\HelloAndroid\bin\classes [dex] Converting compiled files and external libraries into C:\herong\android_20120000\raw\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\drawable-hdpi\ic_launcher.png => C:\herong\HelloAndroid\bin\res\drawable-hdpi\ic_launcher.png [crunch] (processed image to cache entry C:\herong\HelloAndroid\bin\res\drawable-hdpi\ic_launcher.png: 87% size of source) ... [crunch] Crunched 4 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\HelloAndroid-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: 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
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
"HelloAndroid.java" - 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
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
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
USB Debugging Applications on LG-V905R Tablet