You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/02/12 17:08:42 UTC

android commit: Add check for build targets in create script

Updated Branches:
  refs/heads/master dd86d7a5e -> 2683803ef


Add check for build targets in create script

I installed the android sdk via homebrew, which does not install any build targets by default.

That resulted in the create throwing the following somewhat cryptic error.

An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY >&/dev/null exited with 1

This just adds a check that the variables that are set to the values of the build targets are properly set, and exit if they are not.


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/2683803e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/2683803e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/2683803e

Branch: refs/heads/master
Commit: 2683803ef353f533735521930d1ad91eebffcc7d
Parents: dd86d7a
Author: patrick kettner <pa...@patrickkettner.com>
Authored: Fri Jan 11 19:51:38 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Feb 12 11:07:51 2013 -0500

----------------------------------------------------------------------
 bin/create |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2683803e/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index c92acb4..ea214ac 100755
--- a/bin/create
+++ b/bin/create
@@ -98,6 +98,13 @@ 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 ' ')
 
+# check that build targets exist
+if [ -z "$TARGET" ] || [ -z "$API_LEVEL" ]
+then
+    echo "No Android Targets are installed. Please install at least one via the android SDK"
+    exit 1
+fi
+
 # if this a distribution release no need to build a jar
 if [ ! -e "$BUILD_PATH"/cordova-$VERSION.jar ] && [ -d "$BUILD_PATH"/framework ]
 then