From 2683803ef353f533735521930d1ad91eebffcc7d Mon Sep 17 00:00:00 2001 From: patrick kettner Date: Fri, 11 Jan 2013 19:51:38 -0500 Subject: [PATCH] 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. --- bin/create | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/create b/bin/create index c92acb45..ea214ac9 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