Filling the space between You and Your Apps

How to Build the VoiceGap Demo – Part 3 – Android+Windows

You will of course need an Android device.    There is no escaping that requirement.

Next you will need to install the Android SDK.   The best place to learn about this is on the Android Site.   Since most of this work will be done in html you probably don’t need to install eclipse.   So let me present a slightly different set of steps.

Step 1:  Before getting started with the Android SDK, take a moment to confirm that your development computer meets the System Requirements. In particular, you might need to install the JDK, if you don’t have it already.   Yes, that says JDK, short for Java Development [Kit].

Step 2: The SDK starter package is not a full development environment—it includes only the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).  If you haven’t already, get the latest version of the SDK starter package from the SDK download page.

Step 3: If you used the Windows installer, when you complete the installation wizard, it will launch the Android SDK and AVD Manager with a default set of platforms and other components selected for you to install.  (If not, go here to start up SDK and AVD Manager)

Step 4:  Make checkmarks beside SDK-Platform-Tools, and API 2.2 – then continue with install.   Depending on your internet speed, this is a good time for a snack.

Step 5: If you don’t have Ant, you can obtain it from the Apache Ant home page. Install it and make sure it is in your executable PATH. Before calling Ant, you need to declare the JAVA_HOME environment variable to specify the path to where the JDK is installed.  You may want to read the Android Build Page for some background on the topic.  If you get really confused you can try this YouTube Video.

Step 6: What you need now is a complete VoiceGap Application Skeleton to hold the work we have done thus far.  The best place to get one would be the VoiceGap Repository, or alternately here.  You will want to unzip them to a safe easy to find location like say \VoiceGap.

Step 7: Assuming the installation went well, and you downloaded the VoiceGap Skeleton; now we want to build it and see it run on your device!   You need to run a few commands in a dos shell (CMD).

Android update project –path .

Ant debug

C:\>cd \VoiceGap


C:\VoiceGap>"\Program Files\Android\android-sdk\tools\android.bat" update projec
t --path .
Updated local.properties
No project name specified, using Activity name 'VoiceGapActivity'.
If you wish to change it, edit the first line of build.xml.
Added file C:\VoiceGap\build.xml
Updated file C:\VoiceGap\proguard.cfg

C:\VoiceGap>\ant\apache-ant-1.8.2\bin\ant debug
Buildfile: C:\VoiceGap\build.xml





     [echo] Gathering info for VoiceGapActivity...
    [setup] Android SDK Tools Revision 16
    [setup] Project Target: Android 2.2
    [setup] API level: 8
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup] ------------------

     [echo] Creating output directories if needed...


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


    [javac] Compiling 1 source file to C:\VoiceGap\bin\classes



      [dex] Converting compiled files and external libraries into C:\VoiceGap\bi

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

     [aapt] Creating full resource package...
     [aapt] Warning: AndroidManifest.xml already defines debuggable (in http://s
chemas.android.com/apk/res/android); using existing value in manifest.

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

 [zipalign] Running zip align on final apk...
     [echo] Debug Package: C:\VoiceGap\bin\VoiceGapActivity-debug.apk

[propertyfile] Creating new property file: C:\VoiceGap\bin\build.prop
[propertyfile] Updating property file: C:\VoiceGap\bin\build.prop
[propertyfile] Updating property file: C:\VoiceGap\bin\build.prop
[propertyfile] Updating property file: C:\VoiceGap\bin\build.prop

Total time: 13 seconds


Step 8: The Last step is installing it to your device. Connect your device to the computer. Note the ‘-d’ flag means a physical device. You could leave that out and see it in the emulator.

C:\VoiceGap>"\Program Files\Android\android-sdk\platform-tools\adb.exe" -d install -r bin\VoiceGapActivity-debug.apk
238 KB/s (124108 bytes in 0.508s)
        pkg: /data/local/tmp/VoiceGapActivity-debug.apk


Step 9: Success. Take a break. Rest up for the next challenge.

Comments are currently closed.