#
# Similar to
# http://vishalraj.in/blogs/hello-world-writing-my-first-android-app-on-linux
-#
-# The base working dir is assumed to be $HOME/Android
-mkdir $HOME/Android
-cd $HOME/Android
+ANDROID_BASE_DIR=$HOME/Android
+
+mkdir $ANDROID_BASE_DIR
+cd $ANDROID_BASE_DIR
# Download and unpack the SDK from
# http://developer.android.com/sdk/index.html
tar xzvf android-sdk_r21.1-linux.tgz
# Add "platform-tools" and "tools" to the PATH
-export ANDROID_HOME=$HOME/Android/android-sdk-linux
+export ANDROID_HOME=$ANDROID_BASE_DIR/android-sdk-linux
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
# List packages
# Create a Hello World application
# http://developer.android.com/tools/projects/projects-cmdline.html
-mkdir $HOME/Android/Apps
+mkdir $ANDROID_BASE_DIR/Apps
android create project \
--target android-17 \
--name MyFirstApp \
- --path $HOME/Android/Apps/MyFirstApp \
+ --path $ANDROID_BASE_DIR/Apps/MyFirstApp \
--activity MainActivity \
--package com.example.myfirstapp
# And maybe you want to use git for your App?
-cd $HOME/Android/Apps/MyFirstApp
+cd $ANDROID_BASE_DIR/Apps/MyFirstApp
ant clean
git init
git add .
# Build the App
# http://developer.android.com/tools/building/building-cmdline.html
-cd $HOME/Android/Apps/MyFirstApp
+cd $ANDROID_BASE_DIR/Apps/MyFirstApp
ant debug
# Start the emulator, hardware accelerated:
[ "${0#-}" = "$(basename $SHELL)" ] || { echo "This script is meant to be sourced, not executed" 1>&2; exit 1; }
-export ANDROID_HOME=$HOME/Android/android-sdk-linux
+ANDROID_BASE_DIR=$HOME/Android
+
+export ANDROID_HOME=$ANDROID_BASE_DIR/android-sdk-linux
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools