Android and Ant - 4. 執行 Command Build

先確認 環境設置 和 Android Project 底下的 Ant script files 都已經完成,並且了解這幾個 Ant script file 的作用之後,就可以開始執行 command build。

Run Ant script

開啟 DOS 視窗,切換到 Android project 目錄下,輸入

ant.bat -buildfile build.xml release

Build 成功會看到以下訊息,而 APK 會放在 bin 目錄下,以前面使用的 HelloApp 為例,APK 名稱會是:HelloApp-release-unsigned.apk。如果有在 ant.properties 設定 keystore,就會同時產生一個 HelloApp-release-signed.apk

Buildfile: c:\eclipse\workspace\HelloApp\build.xml

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:
   [echo] proguard.config is ${proguard.config}

-pre-build:

-check-env:
[checkenv] Android SDK Tools Revision 22.3.0
[checkenv] Installed at C:\Program Files\Android\android-sdk

-setup:
     [echo] Project Name: HelloApp
  [gettype] Project Type: Application

-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.0
     [echo] Resolving Build Target for HelloApp...
[gettarget] Project Target:   Android 4.4
[gettarget] API level:        19
[gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions.
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: c:\eclipse\workspace\HelloApp\bin\res
    [mkdir] Created dir: c:\eclipse\workspace\HelloApp\bin\rsObj
    [mkdir] Created dir: c:\eclipse\workspace\HelloApp\bin\rsLibs
    [mkdir] Created dir: c:\eclipse\workspace\HelloApp\gen
    [mkdir] Created dir: c:\eclipse\workspace\HelloApp\bin\classes
    [mkdir] Created dir: c:\eclipse\workspace\HelloApp\bin\dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for HelloApp...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'release'...
   [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:\eclipse\workspace\HelloApp\bin\classes

-post-compile:

-obfuscate:

-dex:
          [dex] input: c:\eclipse\workspace\HelloApp\bin\classes
          [dex] Converting compiled files and external libraries into c:\eclipse\workspace\HelloApp\bin\classes.dex...

-crunch:
       [crunch] Crunching PNG Files in source dir: c:\eclipse\workspace\HelloApp\res
       [crunch] To destination dir: c:\eclipse\workspace\HelloApp\bin\res
       [crunch] Processing image to cache: c:\eclipse\workspace\HelloApp\res\drawable-hdpi\ic_launcher.png => c:\eclipse\workspace\HelloApp\bin\res\drawable-hdpi\ic_launcher.png
       [crunch]   (processed image to cache entry c:\eclipse\workspace\HelloApp\bin\res\drawable-hdpi\ic_launcher.png: 87% size of source)
       [crunch] Processing image to cache: c:\eclipse\workspace\HelloApp\res\drawable-ldpi\ic_launcher.png => c:\eclipse\workspace\HelloApp\bin\res\drawable-ldpi\ic_launcher.png
       [crunch]   (processed image to cache entry c:\eclipse\workspace\HelloApp\bin\res\drawable-ldpi\ic_launcher.png: 0% size of source)
       [crunch] Processing image to cache: c:\eclipse\workspace\HelloApp\res\drawable-mdpi\ic_launcher.png => c:\eclipse\workspace\HelloApp\bin\res\drawable-mdpi\ic_launcher.png
       [crunch]   (processed image to cache entry c:\eclipse\workspace\HelloApp\bin\res\drawable-mdpi\ic_launcher.png: 78% size of source)
       [crunch] Processing image to cache: c:\eclipse\workspace\HelloApp\res\drawable-xhdpi\ic_launcher.png => c:\eclipse\workspace\HelloApp\bin\res\drawable-xhdpi\ic_launcher.png
       [crunch]   (processed image to cache entry c:\eclipse\workspace\HelloApp\bin\res\drawable-xhdpi\ic_launcher.png: 85%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 HelloApp-release-unsigned.apk for release...

-post-package:

-release-prompt-for-password:

-release-nosign:
         [echo] No key.store and key.alias properties found in build.properties.
         [echo] Please sign c:\eclipse\workspace\HelloApp\bin\HelloApp-release-unsigned.apk manually
         [echo] and run zipalign from the Android SDK tools.
         [propertyfile] Creating new property file: c:\eclipse\workspace\HelloApp\bin\build.prop
         [propertyfile] Updating property file: c:\eclipse\workspace\HelloApp\bin\build.prop
         [propertyfile] Updating property file: c:\eclipse\workspace\HelloApp\bin\build.prop
         [propertyfile] Updating property file: c:\eclipse\workspace\HelloApp\bin\build.prop

-release-sign:

-post-build:

release:

BUILD SUCCESSFUL
Total time: 14 seconds

Comments

Comments powered by Disqus