You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/01/22 02:57:57 UTC

[50/52] [partial] support for 2.4.0rc1. "vendored" the platform libs in. added Gord and Braden as contributors. removed dependency on unzip and axed the old download-cordova code.

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/create
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create b/lib/cordova-android/bin/create
new file mode 100755
index 0000000..c92acb4
--- /dev/null
+++ b/lib/cordova-android/bin/create
@@ -0,0 +1,159 @@
+#! /bin/bash
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+#
+# create a cordova/android project
+# 
+# USAGE
+#   ./create [path package activity]
+#
+set -e
+
+if [ -z "$1" ] || [ "$1" == "-h" ]
+then
+    echo 'usage: create path package activity'
+    echo "Make sure the Android SDK tools folder is in your PATH!"
+    exit 0
+fi
+
+BUILD_PATH="$( cd "$( dirname "$0" )/.." && pwd )"
+VERSION=$(cat "$BUILD_PATH"/VERSION)
+
+PROJECT_PATH="${1:-'./example'}"
+PACKAGE=${2:-"org.apache.cordova.example"}
+ACTIVITY=${3:-"cordovaExample"}
+
+# clobber any existing example
+if [ -d "$PROJECT_PATH" ]
+then
+    echo "Project already exists! Delete and recreate"
+    exit 1
+fi
+
+# cleanup after exit and/or on error
+function on_exit {
+    # [ -f "$BUILD_PATH"/framework/libs/commons-codec-1.6.jar ] && rm "$BUILD_PATH"/framework/libs/commons-codec-1.6.jar
+    # [ -d "$BUILD_PATH"/framework/libs ] && rmdir "$BUILD_PATH"/framework/libs
+    if [ -f "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js ]
+    then
+        rm "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js
+    fi
+    if [ -f "$BUILD_PATH"/framework/cordova-$VERSION.jar ]
+    then
+        rm "$BUILD_PATH"/framework/cordova-$VERSION.jar
+    fi
+}
+
+function createAppInfoJar {
+    (cd "$BUILD_PATH"/bin/templates/cordova/ApplicationInfo &&
+     javac ApplicationInfo.java &&
+     jar -cfe ../appinfo.jar ApplicationInfo ApplicationInfo.class
+    )
+}
+
+function on_error {
+    echo "An unexpected error occurred: $previous_command exited with $?"
+    echo "Deleting project..."
+    [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH"
+    exit 1
+}
+
+function replace {
+    local pattern=$1
+    local filename=$2
+    # Mac OS X requires -i argument
+    if [[ "$OSTYPE" =~ "darwin" ]]
+    then
+        /usr/bin/sed -i '' -e $pattern "$filename"
+    elif [[ "$OSTYPE" =~ "linux" ]]
+    then
+        /bin/sed -i -e $pattern "$filename"
+    fi
+}
+
+# we do not want the script to silently fail
+trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
+trap on_error ERR
+trap on_exit EXIT
+
+ANDROID_BIN="${ANDROID_BIN:=$( which android )}"
+PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g')
+ACTIVITY_PATH="$PROJECT_PATH"/src/$PACKAGE_AS_PATH/$ACTIVITY.java
+MANIFEST_PATH="$PROJECT_PATH"/AndroidManifest.xml
+
+TARGET=$("$ANDROID_BIN" list targets | grep id: | tail -1 | cut -f 2 -d ' ' )
+API_LEVEL=$("$ANDROID_BIN" list target | grep "API level:" | tail -n 1 | cut -f 2 -d ':' | tr -d ' ')
+
+# if this a distribution release no need to build a jar
+if [ ! -e "$BUILD_PATH"/cordova-$VERSION.jar ] && [ -d "$BUILD_PATH"/framework ]
+then
+# update the cordova-android framework for the desired target
+    "$ANDROID_BIN" update project --target $TARGET --path "$BUILD_PATH"/framework &> /dev/null
+
+    if [ ! -e "$BUILD_PATH"/framework/libs/commons-codec-1.7.jar ]; then
+        # Use curl to get the jar (TODO: Support Apache Mirrors)
+        curl -OL http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip &> /dev/null
+        unzip commons-codec-1.7-bin.zip &> /dev/null
+        mkdir -p "$BUILD_PATH"/framework/libs
+        cp commons-codec-1.7/commons-codec-1.7.jar "$BUILD_PATH"/framework/libs
+        # cleanup yo
+        rm commons-codec-1.7-bin.zip && rm -rf commons-codec-1.7
+    fi
+
+# compile cordova.js and cordova.jar
+    (cd "$BUILD_PATH"/framework && ant jar &> /dev/null )
+fi
+
+# create new android project
+"$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &> /dev/null
+
+# copy project template
+cp -r "$BUILD_PATH"/bin/templates/project/assets "$PROJECT_PATH"
+cp -r "$BUILD_PATH"/bin/templates/project/res "$PROJECT_PATH"
+
+# copy cordova.js, cordova.jar and res/xml
+if [ -d "$BUILD_PATH"/framework ]
+then
+    cp -r "$BUILD_PATH"/framework/res/xml "$PROJECT_PATH"/res
+    cp "$BUILD_PATH"/framework/assets/www/cordova-$VERSION.js "$PROJECT_PATH"/assets/www/cordova-$VERSION.js
+    cp "$BUILD_PATH"/framework/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar
+else
+    cp -r "$BUILD_PATH"/xml "$PROJECT_PATH"/res/xml
+    cp "$BUILD_PATH"/cordova-$VERSION.js "$PROJECT_PATH"/assets/www/cordova-$VERSION.js
+    cp "$BUILD_PATH"/cordova-$VERSION.jar "$PROJECT_PATH"/libs/cordova-$VERSION.jar
+fi
+
+# interpolate the activity name and package
+cp "$BUILD_PATH"/bin/templates/project/Activity.java "$ACTIVITY_PATH"
+replace "s/__ACTIVITY__/${ACTIVITY}/g" "$ACTIVITY_PATH"
+replace "s/__ID__/${PACKAGE}/g" "$ACTIVITY_PATH"
+
+cp "$BUILD_PATH"/bin/templates/project/AndroidManifest.xml "$MANIFEST_PATH"
+replace "s/__ACTIVITY__/${ACTIVITY}/g" "$MANIFEST_PATH"
+replace "s/__PACKAGE__/${PACKAGE}/g" "$MANIFEST_PATH"
+replace "s/__APILEVEL__/${API_LEVEL}/g" "$MANIFEST_PATH"
+
+# creating cordova folder and copying run/build/log/launch scripts
+mkdir "$PROJECT_PATH"/cordova
+createAppInfoJar
+cp "$BUILD_PATH"/bin/templates/cordova/appinfo.jar "$PROJECT_PATH"/cordova/appinfo.jar
+cp "$BUILD_PATH"/bin/templates/cordova/cordova "$PROJECT_PATH"/cordova/cordova
+cp "$BUILD_PATH"/bin/templates/cordova/build "$PROJECT_PATH"/cordova/build
+cp "$BUILD_PATH"/bin/templates/cordova/release "$PROJECT_PATH"/cordova/release
+cp "$BUILD_PATH"/bin/templates/cordova/clean "$PROJECT_PATH"/cordova/clean
+cp "$BUILD_PATH"/bin/templates/cordova/log "$PROJECT_PATH"/cordova/log
+cp "$BUILD_PATH"/bin/templates/cordova/run "$PROJECT_PATH"/cordova/run

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/create.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create.bat b/lib/cordova-android/bin/create.bat
new file mode 100644
index 0000000..35fdc3b
--- /dev/null
+++ b/lib/cordova-android/bin/create.bat
@@ -0,0 +1,32 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+@ECHO OFF
+IF NOT DEFINED JAVA_HOME GOTO MISSING
+FOR %%X in (java.exe javac.exe ant.bat android.bat) do (
+    SET FOUND=%%~$PATH:X
+    IF NOT DEFINED FOUND GOTO MISSING
+)
+cscript "%~dp0\create.js" %*
+GOTO END
+:MISSING
+ECHO Missing one of the following:
+ECHO JDK: http://java.oracle.com
+ECHO Android SDK: http://developer.android.com
+ECHO Apache ant: http://ant.apache.org
+EXIT /B 1
+:END

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/create.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create.js b/lib/cordova-android/bin/create.js
new file mode 100644
index 0000000..258c32c
--- /dev/null
+++ b/lib/cordova-android/bin/create.js
@@ -0,0 +1,214 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+/*
+ * create a cordova/android project
+ *
+ * USAGE
+ *  ./create [path package activity]
+ */
+
+var fso = WScript.CreateObject('Scripting.FileSystemObject');
+
+function read(filename) {
+    var fso=WScript.CreateObject("Scripting.FileSystemObject");
+    var f=fso.OpenTextFile(filename, 1);
+    var s=f.ReadAll();
+    f.Close();
+    return s;
+}
+function setTarget() {
+    var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/id:\s\d+/g);
+    return targets[targets.length - 1].replace(/id: /, ""); // TODO: give users the option to set their target 
+}
+function setApiLevel() {
+    var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/API level:\s\d+/g);
+    return targets[targets.length - 1].replace(/API level: /, "");
+}
+function write(filename, contents) {
+    var fso=WScript.CreateObject("Scripting.FileSystemObject");
+    var f=fso.OpenTextFile(filename, 2, true);
+    f.Write(contents);
+    f.Close();
+}
+function replaceInFile(filename, regexp, replacement) {
+    write(filename, read(filename).replace(regexp, replacement));
+}
+function exec(command) {
+    var oShell=shell.Exec(command);
+    while (oShell.Status == 0) {
+        if(!oShell.StdOut.AtEndOfStream) {
+            var line = oShell.StdOut.ReadLine();
+            // XXX: Change to verbose mode 
+            // WScript.StdOut.WriteLine(line);
+        }
+        WScript.sleep(100);
+    }
+}
+
+function createAppInfoJar() {
+    if(!fso.FileExists(ROOT+"\\bin\\templates\\cordova\\appinfo.jar")) {
+        WScript.Echo("Creating appinfo.jar...");
+        var cur = shell.CurrentDirectory;
+        shell.CurrentDirectory = ROOT+"\\bin\\templates\\cordova\\ApplicationInfo";
+        exec("javac ApplicationInfo.java");
+        exec("jar -cfe ..\\appinfo.jar ApplicationInfo ApplicationInfo.class");
+        shell.CurrentDirectory = cur;
+    }
+}
+
+function cleanup() {
+    // Cleanup
+//    if(fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.6.jar')) {
+//        fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.6.jar');
+//        fso.DeleteFolder(ROOT + '\\framework\\libs', true);
+//    }
+    if(fso.FileExists(ROOT + '\\framework\\cordova-'+VERSION+'.jar')) {
+        fso.DeleteFile(ROOT + '\\framework\\cordova-'+VERSION+'.jar');
+    }
+    if(fso.FileExists(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js')) {
+        fso.DeleteFile(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js');
+    }
+}
+
+function downloadCommonsCodec() {
+    if (!fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.7.jar')) {
+      // We need the .jar
+      var url = 'http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.7-bin.zip';
+      var libsPath = ROOT + '\\framework\\libs';
+      var savePath = libsPath + '\\commons-codec-1.7-bin.zip';
+      if (!fso.FileExists(savePath)) {
+        if(!fso.FolderExists(ROOT + '\\framework\\libs')) {
+            fso.CreateFolder(libsPath);
+        }
+        // We need the zip to get the jar
+        var xhr = WScript.CreateObject('MSXML2.XMLHTTP');
+        xhr.open('GET', url, false);
+        xhr.send();
+        if (xhr.status == 200) {
+          var stream = WScript.CreateObject('ADODB.Stream');
+          stream.Open();
+          stream.Type = 1;
+          stream.Write(xhr.ResponseBody);
+          stream.Position = 0;
+          stream.SaveToFile(savePath);
+          stream.Close();
+        } else {
+          WScript.Echo('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.');
+        }
+      }
+      var app = WScript.CreateObject('Shell.Application');
+      var source = app.NameSpace(savePath).Items();
+      var target = app.NameSpace(ROOT + '\\framework\\libs');
+      target.CopyHere(source, 256);
+      
+      // Move the jar into libs
+      fso.MoveFile(ROOT + '\\framework\\libs\\commons-codec-1.7\\commons-codec-1.7.jar', ROOT + '\\framework\\libs\\commons-codec-1.7.jar');
+      
+      // Clean up
+      fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.7-bin.zip');
+      fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.7', true);
+    }
+}
+
+var args = WScript.Arguments, PROJECT_PATH="example", 
+    PACKAGE="org.apache.cordova.example", ACTIVITY="cordovaExample",
+    shell=WScript.CreateObject("WScript.Shell");
+    
+// working dir
+var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
+
+if (args.Count() == 3) {
+    PROJECT_PATH=args(0);
+    PACKAGE=args(1);
+    ACTIVITY=args(2);
+}
+
+if(fso.FolderExists(PROJECT_PATH)) {
+    WScript.Echo("Project already exists!");
+    WScript.Quit(1);
+}
+
+var PACKAGE_AS_PATH=PACKAGE.replace(/\./g, '\\');
+var ACTIVITY_PATH=PROJECT_PATH+'\\src\\'+PACKAGE_AS_PATH+'\\'+ACTIVITY+'.java';
+var MANIFEST_PATH=PROJECT_PATH+'\\AndroidManifest.xml';
+var TARGET=setTarget();
+var API_LEVEL=setApiLevel();
+var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
+// create the project
+WScript.Echo("Creating new android project...");
+exec('android.bat create project --target '+TARGET+' --path '+PROJECT_PATH+' --package '+PACKAGE+' --activity '+ACTIVITY);
+
+// build from source. distro should have these files
+if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
+    !fso.FileExists(ROOT+'\\cordova-'+VERSION+'.js')) {
+    WScript.Echo("Building jar and js files...");
+    // update the cordova framework project to a target that exists on this machine
+    exec('android.bat update project --target '+TARGET+' --path '+ROOT+'\\framework');
+    // pull down commons codec if necessary
+    downloadCommonsCodec();
+    exec('ant.bat -f \"'+ ROOT +'\\framework\\build.xml\" jar');
+}
+
+// copy in the project template
+WScript.Echo("Copying template files...");
+exec('%comspec% /c xcopy "'+ ROOT + '"\\bin\\templates\\project\\res '+PROJECT_PATH+'\\res\\ /E /Y');
+exec('%comspec% /c xcopy "'+ ROOT + '"\\bin\\templates\\project\\assets '+PROJECT_PATH+'\\assets\\ /E /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\project\\AndroidManifest.xml ' + PROJECT_PATH + '\\AndroidManifest.xml /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\project\\Activity.java '+ ACTIVITY_PATH +' /Y');
+
+// check if we have the source or the distro files
+WScript.Echo("Copying js, jar & config.xml files...");
+if(fso.FolderExists(ROOT + '\\framework')) {
+    exec('%comspec% /c copy "'+ROOT+'"\\framework\\assets\\www\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y');
+    exec('%comspec% /c copy "'+ROOT+'"\\framework\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y');
+    fso.CreateFolder(PROJECT_PATH + '\\res\\xml');
+    exec('%comspec% /c copy "'+ROOT+'"\\framework\\res\\xml\\config.xml ' + PROJECT_PATH + '\\res\\xml\\config.xml /Y');
+} else {
+    // copy in cordova.js
+    exec('%comspec% /c copy "'+ROOT+'"\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y');
+    // copy in cordova.jar
+    exec('%comspec% /c copy "'+ROOT+'"\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y');
+    // copy in xml
+    fso.CreateFolder(PROJECT_PATH + '\\res\\xml');
+    exec('%comspec% /c copy "'+ROOT+'"\\xml\\config.xml ' + PROJECT_PATH + '\\res\\xml\\config.xml /Y');
+}
+
+// copy cordova scripts
+fso.CreateFolder(PROJECT_PATH + '\\cordova');
+createAppInfoJar();
+WScript.Echo("Copying cordova command tools...");
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH + '\\cordova\\appinfo.jar /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.js ' + PROJECT_PATH + '\\cordova\\cordova.js /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH + '\\cordova\\cordova.bat /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\build.bat ' + PROJECT_PATH + '\\cordova\\build.bat /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\log.bat ' + PROJECT_PATH + '\\cordova\\log.bat /Y');
+exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\cordova\\run.bat ' + PROJECT_PATH + '\\cordova\\run.bat /Y');
+
+// interpolate the activity name and package
+WScript.Echo("Updating AndroidManifest.xml and Main Activity...");
+replaceInFile(ACTIVITY_PATH, /__ACTIVITY__/, ACTIVITY);
+replaceInFile(ACTIVITY_PATH, /__ID__/, PACKAGE);
+
+replaceInFile(MANIFEST_PATH, /__ACTIVITY__/, ACTIVITY);
+replaceInFile(MANIFEST_PATH, /__PACKAGE__/, PACKAGE);
+replaceInFile(MANIFEST_PATH, /__APILEVEL__/, API_LEVEL);
+
+cleanup();

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/create.xml
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/create.xml b/lib/cordova-android/bin/create.xml
new file mode 100644
index 0000000..720697c
--- /dev/null
+++ b/lib/cordova-android/bin/create.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+
+<project name="cordova" default="create" basedir="../">
+
+	<property name="project.path" value="${basedir}/example"/>
+	<property name="package" value="org.apache.cordova.example"/>
+	<property name="activity" value="cordovaExample"/>
+
+	<target name="create">
+
+		<!-- this stuff is seriously stupid -->
+		<echo file="tmp/package.tmp">package-as-path=${package}</echo>
+		<replace file="tmp/package.tmp" token="." value="\\" />
+		<property file="tmp/package.tmp" />
+
+		<property name="activity.path" value="${project.path}/src/${package-as-path}/${activity}.java" />
+		<property name="manifest.path" value="${project.path}/AndroidManifest.xml" />
+
+		<!-- get the highest target on this machine -->
+		<!-- this stuff is also seriously stupid -->
+		<exec executable="cmd" osfamily="windows" output="tmp/target.list.tmp">
+			<arg line="/c android.bat list targets"/>
+		</exec>
+		<exec executable="android" osfamily="mac" output="tmp/target.list.tmp">
+			<arg line="list targets"/>
+		</exec>
+		<replaceregexp file="tmp/target.list.tmp" match=".*id:\s([0-9]).*" replace="target=\1" flags="s" />
+		<property file="tmp/target.list.tmp" />
+
+		<!-- var VERSION=read('VERSION').replace(/\r\n/,'').replace(/\n/,''); -->
+		<copy file="VERSION" tofile="tmp/VERSION.tmp" overwrite="true" />
+		<replaceregexp file="tmp/VERSION.tmp" match="^" replace="version=" />
+		<replaceregexp file="tmp/VERSION.tmp" match="\r\n" replace="" />
+		<property file="tmp/VERSION.tmp" />
+
+		<!-- clobber any existing example -->
+
+		<!-- create the project -->
+		<exec executable="cmd" osfamily="windows">
+			<arg line="/c android.bat create project --target ${target} --path ${project.path} --package ${package} --activity ${activity}"/>
+		</exec>
+		<exec executable="android" osfamily="mac">
+			<arg line="create project --target ${target} --path ${project.path} --package ${package} --activity ${activity}"/>
+		</exec>
+
+		<!-- update the framework dir -->
+		<exec executable="cmd" osfamily="windows">
+			<arg line="/c android.bat update project --target ${target} --path ${basedir}/framework"/>
+		</exec>
+		<exec executable="android" osfamily="mac">
+			<arg line="update project --target ${target} --path ${basedir}/framework"/>
+		</exec>
+
+		<!-- compile cordova.js and cordova.jar -->
+		<!--	// if you see an error about "Unable to resolve target" then you may need to 
+				// update your android tools or install an additional Android platform version -->
+		<ant antfile="${basedir}/framework/build.xml" useNativeBasedir="true" inheritAll="false" />
+
+		<!-- copy in the project template -->
+		<copy todir="${project.path}" overwrite="true">
+			<fileset dir="${basedir}/bin/templates/project"/>
+		</copy>
+
+		<!-- copy in cordova.js -->
+		<copy file="${basedir}/framework/assets/www/cordova-${version}.js" todir="${project.path}/assets/www/" />
+
+		<!-- copy in cordova.jar -->
+		<copy file="${basedir}/framework/cordova-${version}.jar" todir="${project.path}/libs/" />
+
+		<!-- copy in default activity -->
+		<copy file="${basedir}/bin/templates/Activity.java" tofile="${activity.path}" overwrite="true" />
+
+		<!-- interpolate the activity name and package -->
+		<replaceregexp file="${activity.path}" match="__ACTIVITY__" replace="${activity}" />
+		<replaceregexp file="${activity.path}" match="__ID__" replace="${package}" />
+
+		<replaceregexp file="${manifest.path}" match="__ACTIVITY__" replace="${activity}" />
+		<replaceregexp file="${manifest.path}" match="__PACKAGE__" replace="${package}" />
+	</target>
+</project>

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/package.json
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/package.json b/lib/cordova-android/bin/package.json
new file mode 100644
index 0000000..27cb0eb
--- /dev/null
+++ b/lib/cordova-android/bin/package.json
@@ -0,0 +1,22 @@
+{
+  "name":         "cordova-android-cli",
+  "description":  "CLI tooling for the cordova-android project",
+  "version":      "0.0.1",
+  "licenses":     [{
+    "type":       "APL 2.0",
+    "url":        "http://www.apache.org/licenses/LICENSE-2.0"
+  }],
+  "main" : "./create",
+  "bin":          {
+    "create":   "./create",
+    "bench":    "./bench",
+    "autotest": "./autotest",
+    "BOOM":     "./BOOM",
+    "test":     "./test"
+  },
+  "homepage":     "http://incubator.apache.org/cordova",
+  "repository":   {
+    "type": "git",
+    "url": "http://git-wip-us.apache.org/repos/asf/incubator-cordova-android.git"
+  }
+}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class b/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
new file mode 100644
index 0000000..2ef42a4
Binary files /dev/null and b/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.class differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java b/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
new file mode 100644
index 0000000..c344b65
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+// http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.xml.sax.SAXException;
+import java.io.IOException;
+
+public class ApplicationInfo {
+    private static void parseAndroidManifest(String path) {
+        // System.out.println(path);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        Document dom;
+        try {
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            dom = db.parse(path);
+
+            // getting package information
+            Element manifest = dom.getDocumentElement();
+            String pakkage = manifest.getAttribute("package");
+
+            // getting activity name
+            String activity = ((Element)dom.getElementsByTagName("activity").item(0)).getAttribute("android:name");
+            System.out.println(String.format("%s/.%s", pakkage, activity.replace(".", "")));
+        } catch(ParserConfigurationException pce) {
+			pce.printStackTrace();
+		} catch(SAXException se) {
+			se.printStackTrace();
+		} catch(IOException ioe) {
+			ioe.printStackTrace();
+		}
+        
+    }
+
+    public static void main(String[] args) {
+        String path;
+        if(args.length > 0) {
+            path = args[0];
+        } else {
+            path = System.getProperty("user.dir") + "/../AndroidManifest.xml";
+        }
+        parseAndroidManifest(path);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/appinfo.jar
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/appinfo.jar b/lib/cordova-android/bin/templates/cordova/appinfo.jar
new file mode 100644
index 0000000..9cc229d
Binary files /dev/null and b/lib/cordova-android/bin/templates/cordova/appinfo.jar differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/build
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/build b/lib/cordova-android/bin/templates/cordova/build
new file mode 100755
index 0000000..e586e4d
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/build
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+
+bash "$CORDOVA_PATH"/cordova build

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/build.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/build.bat b/lib/cordova-android/bin/templates/cordova/build.bat
new file mode 100644
index 0000000..8e6ca9a
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/build.bat
@@ -0,0 +1,18 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+%~dp0\cordova.bat build

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/clean
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/clean b/lib/cordova-android/bin/templates/cordova/clean
new file mode 100755
index 0000000..53b7f9a
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/clean
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+
+bash "$CORDOVA_PATH"/cordova clean

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/clean.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/clean.bat b/lib/cordova-android/bin/templates/cordova/clean.bat
new file mode 100644
index 0000000..fe5c09f
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/clean.bat
@@ -0,0 +1,18 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+%~dp0\cordova.bat clean

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/cordova
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/cordova b/lib/cordova-android/bin/templates/cordova/cordova
new file mode 100755
index 0000000..1945a4c
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/cordova
@@ -0,0 +1,159 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+
+PROJECT_PATH=$( cd "$( dirname "$0" )/.." && pwd )
+
+function check_devices {
+# FIXME
+    local devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep device`
+    if [ -z "$devices"  ] ; then
+        echo "1"
+    else
+        echo "0"
+    fi
+}
+
+function emulate {
+    declare -a avd_list=($(android list avd | grep "Name:" | cut -f 2 -d ":" | xargs))
+    # we need to start adb-server
+    adb start-server 1>/dev/null
+
+    # Do not launch an emulator if there is already one running or if a device is attached
+    if [ $(check_devices) == 0 ] ; then
+        return
+    fi
+
+    local avd_id="1000" #FIXME: hopefully user does not have 1000 AVDs
+    # User has no AVDs
+    if [ ${#avd_list[@]} == 0 ]
+    then
+        echo "You don't have any Android Virtual Devices. Please create at least one AVD."
+        echo "android"
+    fi
+    # User has only one AVD
+    if [ ${#avd_list[@]} == 1 ]
+    then
+        emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[0]} 1> /dev/null 2>&1 &
+    # User has more than 1 AVD
+    elif [ ${#avd_list[@]} -gt 1 ]
+    then
+        while [ -z ${avd_list[$avd_id]} ]
+        do
+            echo "Choose from one of the following Android Virtual Devices [0 to $((${#avd_list[@]}-1))]:"
+            for(( i = 0 ; i < ${#avd_list[@]} ; i++ ))
+            do
+                echo "$i) ${avd_list[$i]}"
+            done
+            read -t 5 -p "> " avd_id
+            # default value if input timeout
+            if [ $avd_id -eq 1000 ] ; then avd_id=0 ; fi
+        done
+        emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[$avd_id]} 1> /dev/null 2>&1 &
+    fi
+    
+}
+
+function clean {
+    ant clean
+}
+# has to be used independently and not in conjunction with other commands
+function log {
+    adb logcat
+}
+
+function run {
+    clean && emulate && wait_for_device && install && launch 
+}
+
+function install {
+    
+    declare -a devices=($(adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}' | grep device | cut -f 1))
+    local device_id="1000" #FIXME: hopefully user does not have 1000 AVDs
+    
+    if [ ${#devices[@]} == 0 ]
+    then
+        # should not reach here. Emulator should launch or device should be attached
+        echo "Emulator not running or device not attached. Could not install debug package"
+        exit 70
+    fi
+    
+    if [ ${#devices[@]} == 1 ]
+    then
+        export ANDROID_SERIAL=${devices[0]}
+    # User has more than 1 AVD
+    elif [ ${#devices[@]} -gt 1 ]
+    then
+        while [ -z ${devices[$device_id]} ]
+        do
+            echo "Choose from one of the following devices/emulators [0 to $((${#devices[@]}-1))]:"
+            for(( i = 0 ; i < ${#devices[@]} ; i++ ))
+            do
+                echo "$i) ${devices[$i]}"
+            done
+            read -t 5 -p "> " device_id
+            # default value if input timeout
+            if [ $device_id -eq 1000 ] ; then device_id=0 ; fi
+        done
+        export ANDROID_SERIAL=${devices[$device_id]}
+    fi
+
+    ant debug install
+}
+
+function build {
+    ant debug
+}
+
+function release {
+    ant release
+}
+
+function wait_for_device {
+    local i="0"
+    echo -n "Waiting for device..."
+
+    while [ $i -lt 300 ]
+    do
+        if [ $(check_devices) -eq 0 ]
+        then
+            break
+        else
+            sleep 1
+            i=$[i+1]
+            echo -n "."
+        fi
+    done
+    # Device timeout: emulator has not started in time or device not attached
+    if [ $i -eq 300 ]
+    then
+        echo "device timeout!"
+        exit 69
+    else
+        echo "connected!"
+    fi
+}
+
+function launch {
+    local launch_str=$(java -jar "$PROJECT_PATH"/cordova/appinfo.jar "$PROJECT_PATH"/AndroidManifest.xml)
+    adb shell am start -n $launch_str 
+}
+
+# TODO parse arguments
+(cd "$PROJECT_PATH" && $1)

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/cordova.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/cordova.bat b/lib/cordova-android/bin/templates/cordova/cordova.bat
new file mode 100644
index 0000000..22c289a
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/cordova.bat
@@ -0,0 +1,32 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+@ECHO OFF
+IF NOT DEFINED JAVA_HOME GOTO MISSING
+FOR %%X in (java.exe ant.bat android.bat) do (
+    SET FOUND=%%~$PATH:X
+    IF NOT DEFINED FOUND GOTO MISSING
+)
+cscript %~dp0\cordova.js %*
+GOTO END
+:MISSING
+ECHO Missing one of the following:
+ECHO JDK: http://java.oracle.com
+ECHO Android SDK: http://developer.android.com
+ECHO Apache ant: http://ant.apache.org
+EXIT /B 1
+:END

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/cordova.js b/lib/cordova-android/bin/templates/cordova/cordova.js
new file mode 100644
index 0000000..51533cb
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/cordova.js
@@ -0,0 +1,137 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+// http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+var ROOT = WScript.ScriptFullName.split('\\cordova\\cordova.js').join(''),
+    shell=WScript.CreateObject("WScript.Shell");
+
+function exec(command) {
+    var oExec=shell.Exec(command);
+    var output = new String();
+    while(oExec.Status == 0) {
+        if(!oExec.StdOut.AtEndOfStream) {
+            var line = oExec.StdOut.ReadLine();
+            // XXX: Change to verbose mode 
+            // WScript.StdOut.WriteLine(line);
+            output += line;
+        }
+        WScript.sleep(100);
+    }
+
+    return output;
+}
+
+function device_running() {
+    var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll();
+    if(local_devices.match(/\w+\tdevice/)) {
+        WScript.Echo("Yes");
+        return true;
+    }
+    WScript.Echo("No");
+    return false;
+}
+function emulate() {
+    // don't run emulator if a device is plugged in or if emulator is already running
+    if(device_running()) {
+        //WScript.Echo("Device or Emulator already running!");
+        return;
+    }
+    var oExec = shell.Exec("%comspec% /c android.bat list avd");
+    var avd_list = [];
+    var avd_id = -10;
+    while(!oExec.StdOut.AtEndOfStream) {
+        var output = oExec.StdOut.ReadLine();
+        if(output.match(/Name: (.)*/)) {
+            avd_list.push(output.replace(/ *Name:\s/, ""));
+        }
+    }
+    // user has no AVDs
+    if(avd_list.length == 0) {
+        WScript.Echo("You don't have any Android Virtual Devices. Please create at least one AVD.");
+        WScript.Echo("android");
+        WScript.Quit(1);
+    }
+    // user has only one AVD so we launch that one
+    if(avd_list.length == 1) {
+
+        shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\cache -avd "+avd_list[0]);
+    }
+
+    // user has more than one avd so we ask them to choose
+    if(avd_list.length > 1) {
+        while(!avd_list[avd_id]) {
+            WScript.Echo("Choose from one of the following Android Virtual Devices [0 to "+(avd_list.length - 1)+"]:")
+            for(i = 0, j = avd_list.length ; i < j ; i++) {
+                WScript.Echo((i)+") "+avd_list[i]);
+            }
+            WScript.StdOut.Write("> ");
+            avd_id = new Number(WScript.StdIn.ReadLine());
+        }
+
+        shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\\cache -avd "+avd_list[avd_id], 0, false);
+    }
+}
+
+function clean() {
+    WScript.Echo("Cleaning project...");
+    exec("%comspec% /c ant.bat clean -f "+ROOT+"\\build.xml 2>&1");
+}
+
+function build() {
+    WScript.Echo("Building project...");
+    exec("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1");
+}
+
+function install() {
+    WScript.Echo("Building/Installing project...");
+    exec("%comspec% /c ant.bat debug install -f "+ROOT+"\\build.xml 2>&1");
+}
+
+function log() {
+    shell.Run("%comspec% /c adb logcat");
+}
+
+function launch() {
+    WScript.Echo("Launching app...");
+    var launch_str=exec("%comspec% /c java -jar "+ROOT+"\\cordova\\appinfo.jar "+ROOT+"\\AndroidManifest.xml");
+    //WScript.Echo(launch_str);
+    exec("%comspec% /c adb shell am start -n "+launch_str+" 2>&1");
+}
+
+function run() {
+    var i=0;
+   clean();
+   emulate();
+   WScript.Stdout.Write('Waiting for device...');
+   while(!device_running() && i < 300) {
+        WScript.Stdout.Write('.');
+        WScript.sleep(1000);
+        i += 1;
+   }
+   if(i == 300) {
+       WScript.Stderr.WriteLine("device/emulator timeout!"); 
+   } else {
+       WScript.Stdout.WriteLine("connected!");
+   }
+   install();
+   launch();
+}
+var args = WScript.Arguments;
+if(args.count() != 1) {
+    WScript.StdErr.Write("An error has occured!\n");
+    WScript.Quit(1);
+}
+eval(args(0)+"()");

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/log
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/log b/lib/cordova-android/bin/templates/cordova/log
new file mode 100755
index 0000000..087a200
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/log
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )/.." && pwd )
+
+bash "$CORDOVA_PATH"/cordova/cordova log

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/log.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/log.bat b/lib/cordova-android/bin/templates/cordova/log.bat
new file mode 100644
index 0000000..b8cc6be
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/log.bat
@@ -0,0 +1,18 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+:: 
+:: http://www.apache.org/licenses/LICENSE-2.0
+:: 
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied.  See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+%~dp0\cordova.bat log

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/release
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/release b/lib/cordova-android/bin/templates/cordova/release
new file mode 100755
index 0000000..73d873e
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/release
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+
+bash "$CORDOVA_PATH"/cordova release

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/run
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/run b/lib/cordova-android/bin/templates/cordova/run
new file mode 100755
index 0000000..840a8d5
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/run
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#!/bin/bash
+
+set -e
+
+CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
+
+bash "$CORDOVA_PATH"/cordova run

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/cordova/run.bat
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/cordova/run.bat b/lib/cordova-android/bin/templates/cordova/run.bat
new file mode 100644
index 0000000..7c470ed
--- /dev/null
+++ b/lib/cordova-android/bin/templates/cordova/run.bat
@@ -0,0 +1 @@
+%~dp0\cordova.bat run

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/Activity.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/Activity.java b/lib/cordova-android/bin/templates/project/Activity.java
new file mode 100644
index 0000000..c255e4c
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/Activity.java
@@ -0,0 +1,36 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+ */
+
+package __ID__;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class __ACTIVITY__ extends DroidGap
+{
+    @Override
+    public void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+        // Set by <content src="index.html" /> in config.xml
+        super.loadUrl(Config.getStartUrl());
+        //super.loadUrl("file:///android_asset/www/index.html")
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/AndroidManifest.xml b/lib/cordova-android/bin/templates/project/AndroidManifest.xml
new file mode 100644
index 0000000..090c41e
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/AndroidManifest.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
+      package="__PACKAGE__" android:versionName="1.1" android:versionCode="5" android:hardwareAccelerated="true">
+    <supports-screens
+        android:largeScreens="true"
+        android:normalScreens="true"
+        android:smallScreens="true"
+        android:xlargeScreens="true"
+        android:resizeable="true"
+        android:anyDensity="true"
+        />
+
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.RECEIVE_SMS" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission android:name="android.permission.RECORD_VIDEO"/>
+    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
+    <uses-permission android:name="android.permission.WRITE_CONTACTS" />   
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />   
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+
+
+    <application android:icon="@drawable/icon" android:label="@string/app_name"
+        android:hardwareAccelerated="true"
+        android:debuggable="true">
+        <activity android:name="__ACTIVITY__" android:label="@string/app_name"
+                android:theme="@android:style/Theme.Black.NoTitleBar"
+                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+
+    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="__APILEVEL__"/>
+</manifest> 

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/css/index.css
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/css/index.css b/lib/cordova-android/bin/templates/project/assets/www/css/index.css
new file mode 100644
index 0000000..51daa79
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/css/index.css
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+* {
+    -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
+}
+
+body {
+    -webkit-touch-callout: none;                /* prevent callout to copy image, etc when tap to hold */
+    -webkit-text-size-adjust: none;             /* prevent webkit from resizing text to fit */
+    -webkit-user-select: none;                  /* prevent copy paste, to allow, change 'none' to 'text' */
+    background-color:#E4E4E4;
+    background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+    background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+    background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+    background-image:-webkit-gradient(
+        linear,
+        left top,
+        left bottom,
+        color-stop(0, #A7A7A7),
+        color-stop(0.51, #E4E4E4)
+    );
+    background-attachment:fixed;
+    font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
+    font-size:12px;
+    height:100%;
+    margin:0px;
+    padding:0px;
+    text-transform:uppercase;
+    width:100%;
+}
+
+/* Portrait layout (default) */
+.app {
+    background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
+    position:absolute;             /* position in the center of the screen */
+    left:50%;
+    top:50%;
+    height:50px;                   /* text area height */
+    width:225px;                   /* text area width */
+    text-align:center;
+    padding:180px 0px 0px 0px;     /* image height is 200px (bottom 20px are overlapped with text) */
+    margin:-115px 0px 0px -112px;  /* offset vertical: half of image height and text area height */
+                                   /* offset horizontal: half of text area width */
+}
+
+/* Landscape layout (with min-width) */
+@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
+    .app {
+        background-position:left center;
+        padding:75px 0px 75px 170px;  /* padding-top + padding-bottom + text area = image height */
+        margin:-90px 0px 0px -198px;  /* offset vertical: half of image height */
+                                      /* offset horizontal: half of image width and text area width */
+    }
+}
+
+h1 {
+    font-size:24px;
+    font-weight:normal;
+    margin:0px;
+    overflow:visible;
+    padding:0px;
+    text-align:center;
+}
+
+.event {
+    border-radius:4px;
+    -webkit-border-radius:4px;
+    color:#FFFFFF;
+    font-size:12px;
+    margin:0px 30px;
+    padding:2px 0px;
+}
+
+.event.listening {
+    background-color:#333333;
+    display:block;
+}
+
+.event.received {
+    background-color:#4B946A;
+    display:none;
+}
+
+@keyframes fade {
+    from { opacity: 1.0; }
+    50% { opacity: 0.4; }
+    to { opacity: 1.0; }
+}
+ 
+@-webkit-keyframes fade {
+    from { opacity: 1.0; }
+    50% { opacity: 0.4; }
+    to { opacity: 1.0; }
+}
+ 
+.blink {
+    animation:fade 3000ms infinite;
+    -webkit-animation:fade 3000ms infinite;
+}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/img/cordova.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/img/cordova.png b/lib/cordova-android/bin/templates/project/assets/www/img/cordova.png
new file mode 100644
index 0000000..e8169cf
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/img/cordova.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/img/logo.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/img/logo.png b/lib/cordova-android/bin/templates/project/assets/www/img/logo.png
new file mode 100644
index 0000000..9519e7d
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/img/logo.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/index.html
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/index.html b/lib/cordova-android/bin/templates/project/assets/www/index.html
new file mode 100644
index 0000000..d45ae9f
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/index.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+        <meta name="format-detection" content="telephone=no" />
+        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
+        <link rel="stylesheet" type="text/css" href="css/index.css" />
+        <title>Hello World</title>
+    </head>
+    <body>
+        <div class="app">
+            <h1>Apache Cordova</h1>
+            <div id="deviceready" class="blink">
+                <p class="event listening">Connecting to Device</p>
+                <p class="event received">Device is Ready</p>
+            </div>
+        </div>
+        <script type="text/javascript" src="cordova-2.4.0rc1.js"></script>
+        <script type="text/javascript" src="js/index.js"></script>
+        <script type="text/javascript">
+            app.initialize();
+        </script>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/js/index.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/js/index.js b/lib/cordova-android/bin/templates/project/assets/www/js/index.js
new file mode 100644
index 0000000..31d9064
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/js/index.js
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+var app = {
+    // Application Constructor
+    initialize: function() {
+        this.bindEvents();
+    },
+    // Bind Event Listeners
+    //
+    // Bind any events that are required on startup. Common events are:
+    // 'load', 'deviceready', 'offline', and 'online'.
+    bindEvents: function() {
+        document.addEventListener('deviceready', this.onDeviceReady, false);
+    },
+    // deviceready Event Handler
+    //
+    // The scope of 'this' is the event. In order to call the 'receivedEvent'
+    // function, we must explicity call 'app.receivedEvent(...);'
+    onDeviceReady: function() {
+        app.receivedEvent('deviceready');
+    },
+    // Update DOM on a Received Event
+    receivedEvent: function(id) {
+        var parentElement = document.getElementById(id);
+        var listeningElement = parentElement.querySelector('.listening');
+        var receivedElement = parentElement.querySelector('.received');
+
+        listeningElement.setAttribute('style', 'display:none;');
+        receivedElement.setAttribute('style', 'display:block;');
+
+        console.log('Received Event: ' + id);
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/main.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/main.js b/lib/cordova-android/bin/templates/project/assets/www/main.js
new file mode 100644
index 0000000..3a8b04a
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/main.js
@@ -0,0 +1,165 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+var deviceInfo = function() {
+    document.getElementById("platform").innerHTML = device.platform;
+    document.getElementById("version").innerHTML = device.version;
+    document.getElementById("uuid").innerHTML = device.uuid;
+    document.getElementById("name").innerHTML = device.name;
+    document.getElementById("width").innerHTML = screen.width;
+    document.getElementById("height").innerHTML = screen.height;
+    document.getElementById("colorDepth").innerHTML = screen.colorDepth;
+};
+
+var getLocation = function() {
+    var suc = function(p) {
+        alert(p.coords.latitude + " " + p.coords.longitude);
+    };
+    var locFail = function() {
+    };
+    navigator.geolocation.getCurrentPosition(suc, locFail);
+};
+
+var beep = function() {
+    navigator.notification.beep(2);
+};
+
+var vibrate = function() {
+    navigator.notification.vibrate(0);
+};
+
+function roundNumber(num) {
+    var dec = 3;
+    var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+    return result;
+}
+
+var accelerationWatch = null;
+
+function updateAcceleration(a) {
+    document.getElementById('x').innerHTML = roundNumber(a.x);
+    document.getElementById('y').innerHTML = roundNumber(a.y);
+    document.getElementById('z').innerHTML = roundNumber(a.z);
+}
+
+var toggleAccel = function() {
+    if (accelerationWatch !== null) {
+        navigator.accelerometer.clearWatch(accelerationWatch);
+        updateAcceleration({
+            x : "",
+            y : "",
+            z : ""
+        });
+        accelerationWatch = null;
+    } else {
+        var options = {};
+        options.frequency = 1000;
+        accelerationWatch = navigator.accelerometer.watchAcceleration(
+                updateAcceleration, function(ex) {
+                    alert("accel fail (" + ex.name + ": " + ex.message + ")");
+                }, options);
+    }
+};
+
+var preventBehavior = function(e) {
+    e.preventDefault();
+};
+
+function dump_pic(data) {
+    var viewport = document.getElementById('viewport');
+    console.log(data);
+    viewport.style.display = "";
+    viewport.style.position = "absolute";
+    viewport.style.top = "10px";
+    viewport.style.left = "10px";
+    document.getElementById("test_img").src = data;
+}
+
+function fail(msg) {
+    alert(msg);
+}
+
+function show_pic() {
+    navigator.camera.getPicture(dump_pic, fail, {
+        quality : 50
+    });
+}
+
+function close() {
+    var viewport = document.getElementById('viewport');
+    viewport.style.position = "relative";
+    viewport.style.display = "none";
+}
+
+function contacts_success(contacts) {
+    alert(contacts.length
+            + ' contacts returned.'
+            + (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted)
+                    : ''));
+}
+
+function get_contacts() {
+    var obj = new ContactFindOptions();
+    obj.filter = "";
+    obj.multiple = true;
+    navigator.contacts.find(
+            [ "displayName", "name" ], contacts_success,
+            fail, obj);
+}
+
+function check_network() {
+    var networkState = navigator.network.connection.type;
+
+    var states = {};
+    states[Connection.UNKNOWN]  = 'Unknown connection';
+    states[Connection.ETHERNET] = 'Ethernet connection';
+    states[Connection.WIFI]     = 'WiFi connection';
+    states[Connection.CELL_2G]  = 'Cell 2G connection';
+    states[Connection.CELL_3G]  = 'Cell 3G connection';
+    states[Connection.CELL_4G]  = 'Cell 4G connection';
+    states[Connection.NONE]     = 'No network connection';
+
+    confirm('Connection type:\n ' + states[networkState]);
+}
+
+var watchID = null;
+
+function updateHeading(h) {
+    document.getElementById('h').innerHTML = h.magneticHeading;
+}
+
+function toggleCompass() {
+    if (watchID !== null) {
+        navigator.compass.clearWatch(watchID);
+        watchID = null;
+        updateHeading({ magneticHeading : "Off"});
+    } else {        
+        var options = { frequency: 1000 };
+        watchID = navigator.compass.watchHeading(updateHeading, function(e) {
+            alert('Compass Error: ' + e.code);
+        }, options);
+    }
+}
+
+function init() {
+    // the next line makes it impossible to see Contacts on the HTC Evo since it
+    // doesn't have a scroll button
+    // document.addEventListener("touchmove", preventBehavior, false);
+    document.addEventListener("deviceready", deviceInfo, true);
+}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/master.css
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/master.css b/lib/cordova-android/bin/templates/project/assets/www/master.css
new file mode 100644
index 0000000..3aad33d
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/master.css
@@ -0,0 +1,116 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+
+ body {
+    background:#222 none repeat scroll 0 0;
+    color:#666;
+    font-family:Helvetica;
+    font-size:72%;
+    line-height:1.5em;
+    margin:0;
+    border-top:1px solid #393939;
+  }
+
+  #info{
+    background:#ffa;
+    border: 1px solid #ffd324;
+    -webkit-border-radius: 5px;
+    border-radius: 5px;
+    clear:both;
+    margin:15px 6px 0;
+    width:295px;
+    padding:4px 0px 2px 10px;
+  }
+  
+  #info > h4{
+    font-size:.95em;
+    margin:5px 0;
+  }
+ 	
+  #stage.theme{
+    padding-top:3px;
+  }
+
+  /* Definition List */
+  #stage.theme > dl{
+  	padding-top:10px;
+  	clear:both;
+  	margin:0;
+  	list-style-type:none;
+  	padding-left:10px;
+  	overflow:auto;
+  }
+
+  #stage.theme > dl > dt{
+  	font-weight:bold;
+  	float:left;
+  	margin-left:5px;
+  }
+
+  #stage.theme > dl > dd{
+  	width:45px;
+  	float:left;
+  	color:#a87;
+  	font-weight:bold;
+  }
+
+  /* Content Styling */
+  #stage.theme > h1, #stage.theme > h2, #stage.theme > p{
+    margin:1em 0 .5em 13px;
+  }
+
+  #stage.theme > h1{
+    color:#eee;
+    font-size:1.6em;
+    text-align:center;
+    margin:0;
+    margin-top:15px;
+    padding:0;
+  }
+
+  #stage.theme > h2{
+  	clear:both;
+    margin:0;
+    padding:3px;
+    font-size:1em;
+    text-align:center;
+  }
+
+  /* Stage Buttons */
+  #stage.theme a.btn{
+  	border: 1px solid #555;
+  	-webkit-border-radius: 5px;
+  	border-radius: 5px;
+  	text-align:center;
+  	display:block;
+  	float:left;
+  	background:#444;
+  	width:150px;
+  	color:#9ab;
+  	font-size:1.1em;
+  	text-decoration:none;
+  	padding:1.2em 0;
+  	margin:3px 0px 3px 5px;
+  }
+  #stage.theme a.btn.large{
+  	width:308px;
+  	padding:1.2em 0;
+  }
+

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-36-ldpi.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-36-ldpi.png b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-36-ldpi.png
new file mode 100644
index 0000000..cd5032a
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-36-ldpi.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-48-mdpi.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-48-mdpi.png b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-48-mdpi.png
new file mode 100644
index 0000000..e79c606
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-48-mdpi.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-72-hdpi.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-72-hdpi.png b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-72-hdpi.png
new file mode 100644
index 0000000..4d27634
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-72-hdpi.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-96-xhdpi.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-96-xhdpi.png b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-96-xhdpi.png
new file mode 100644
index 0000000..ec7ffbf
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/icon/android/icon-96-xhdpi.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-landscape.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-landscape.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-landscape.png
new file mode 100644
index 0000000..a61e2b1
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-landscape.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-portrait.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-portrait.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-portrait.png
new file mode 100644
index 0000000..5d6a28a
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-hdpi-portrait.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-landscape.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-landscape.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-landscape.png
new file mode 100644
index 0000000..f3934cd
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-landscape.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-portrait.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-portrait.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-portrait.png
new file mode 100644
index 0000000..65ad163
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-ldpi-portrait.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-landscape.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-landscape.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-landscape.png
new file mode 100644
index 0000000..a1b697c
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-landscape.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-portrait.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-portrait.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-portrait.png
new file mode 100644
index 0000000..ea15693
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-mdpi-portrait.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-landscape.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-landscape.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-landscape.png
new file mode 100644
index 0000000..79f2f09
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-landscape.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-portrait.png
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-portrait.png b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-portrait.png
new file mode 100644
index 0000000..c2e8042
Binary files /dev/null and b/lib/cordova-android/bin/templates/project/assets/www/res/screen/android/screen-xhdpi-portrait.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/spec.html
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/spec.html b/lib/cordova-android/bin/templates/project/assets/www/spec.html
new file mode 100644
index 0000000..71f00de
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/spec.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<html>
+    <head>
+        <title>Jasmine Spec Runner</title>
+
+        <!-- jasmine source -->
+        <link rel="shortcut icon" type="image/png" href="spec/lib/jasmine-1.2.0/jasmine_favicon.png">
+        <link rel="stylesheet" type="text/css" href="spec/lib/jasmine-1.2.0/jasmine.css">
+        <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine.js"></script>
+        <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine-html.js"></script>
+
+        <!-- include source files here... -->
+        <script type="text/javascript" src="js/index.js"></script>
+
+        <!-- include spec files here... -->
+        <script type="text/javascript" src="spec/helper.js"></script>
+        <script type="text/javascript" src="spec/index.js"></script>
+
+        <script type="text/javascript">
+            (function() {
+                var jasmineEnv = jasmine.getEnv();
+                jasmineEnv.updateInterval = 1000;
+
+                var htmlReporter = new jasmine.HtmlReporter();
+
+                jasmineEnv.addReporter(htmlReporter);
+
+                jasmineEnv.specFilter = function(spec) {
+                    return htmlReporter.specFilter(spec);
+                };
+
+                var currentWindowOnload = window.onload;
+
+                window.onload = function() {
+                    if (currentWindowOnload) {
+                        currentWindowOnload();
+                    }
+                    execJasmine();
+                };
+
+                function execJasmine() {
+                    jasmineEnv.execute();
+                }
+            })();
+        </script>
+    </head>
+    <body>
+        <div id="stage" style="display:none;"></div>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/bin/templates/project/assets/www/spec/helper.js
----------------------------------------------------------------------
diff --git a/lib/cordova-android/bin/templates/project/assets/www/spec/helper.js b/lib/cordova-android/bin/templates/project/assets/www/spec/helper.js
new file mode 100644
index 0000000..929f776
--- /dev/null
+++ b/lib/cordova-android/bin/templates/project/assets/www/spec/helper.js
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+afterEach(function() {
+    document.getElementById('stage').innerHTML = '';
+});
+
+var helper = {
+    trigger: function(obj, name) {
+        var e = document.createEvent('Event');
+        e.initEvent(name, true, true);
+        obj.dispatchEvent(e);
+    },
+    getComputedStyle: function(querySelector, property) {
+        var element = document.querySelector(querySelector);
+        return window.getComputedStyle(element).getPropertyValue(property);
+    }
+};