Skip to content

Instantly share code, notes, and snippets.

@mwbrooks
Created August 18, 2011 05:32

Revisions

  1. mwbrooks created this gist Aug 18, 2011.
    73 changes: 73 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,73 @@
    #
    # Based on the PhoneGap Android Terminal Quickstart Guide:
    # http://wiki.phonegap.com/w/page/30864168/phonegap-android-terminal-quickstart
    #

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # Setting up your System
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

    # It's easier if you have the Android SDK in your PATH.
    # You can accomplish this by adding the following line
    # to your ~/.bashrc or ~/.profile.
    # Your Android SDK path and name be slightly different.

    export PATH=$PATH:/Applications/android-sdk-mac/tools/

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # Setting up a new Project
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

    # Change into an existing PhoneGap-Android project.
    # I use the PhoneGap-Android sample to create new projects.

    cd existing/android/project

    # List your installed Android SDK targets
    # You will want to update the project to
    # build to one or more of these SDKs

    android list targets

    # The output will be similar to:
    #
    # Available Android targets:
    # id: 1 or "android-8"
    # Name: Android 2.2
    # Type: Platform
    # API level: 8
    # Revision: 2
    # Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
    # id: 2 or "android-12"
    # Name: Android 3.1
    # Type: Platform
    # API level: 12
    # Revision: 3
    # Skins: WXGA (default)

    # Update your project to build to at least one
    # of these SDKs. Below, I target the Android 2.2
    # SDK (id: 1).

    android update project -p . -t 1

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # Building and Running your Project
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

    # First, you will need to connect your Android device
    # or launch a simulator. Below, I show how to launch
    # the simulator from the command-line

    android

    # Create a new Android Virtual Device (AVD) or select
    # an existing one and click "Start..." on the right-side.

    # Once the simulator has booted (or device is connected)
    # you can install your application

    ant debug install

    # Debug will sign the application with debug key. If you have
    # setup a release key, then you can run `ant release install`