Use a variable to set the base directory for Android development
[android/android-app-development-getting-started.git] / android-app-development-getting-started.sh
index 971aa72..faee212 100755 (executable)
@@ -5,11 +5,11 @@
 #
 # Similar to
 # http://vishalraj.in/blogs/hello-world-writing-my-first-android-app-on-linux
 #
 # 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
 
 # Download and unpack the SDK from
 # http://developer.android.com/sdk/index.html
@@ -17,7 +17,7 @@ wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz
 tar xzvf android-sdk_r21.1-linux.tgz
 
 # Add "platform-tools" and "tools" to the PATH
 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
 export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
 
 # List packages
@@ -37,16 +37,16 @@ sudo aptitude install ant
 
 # Create a Hello World application
 # http://developer.android.com/tools/projects/projects-cmdline.html
 
 # 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 \
 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?
        --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 .
 ant clean
 git init
 git add .
@@ -63,7 +63,7 @@ http://developer.android.com/training/basics/firstapp/building-ui.html
 
 # Build the App
 # http://developer.android.com/tools/building/building-cmdline.html
 
 # 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:
 ant debug
 
 # Start the emulator, hardware accelerated: