3 # Tutorial about getting started with android App development from the command
7 # http://vishalraj.in/blogs/hello-world-writing-my-first-android-app-on-linux
10 # The base working dir is assumed to be $HOME/Android
14 # Download and unpack the SDK from
15 # http://developer.android.com/sdk/index.html
16 wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz
17 tar xzvf android-sdk_r21.1-linux.tgz
19 # Add "platform-tools" and "tools" to the PATH
20 export ANDROID_HOME=$HOME/Android/android-sdk-linux
21 export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
24 android list sdk --extended
26 # Install packages. Use this same command line to update the packages
27 android update sdk --no-ui --filter platform-tools,android-17,sys-img-17,extra-android-support
29 # Check what targets are available
32 # Create an Android Virtual Device (AVD)
33 android create avd --target android-17 --name android-17-x86 --abi x86
35 # Install "ant" to build packages
36 sudo aptitude install ant
38 # Create a Hello World application
39 # http://developer.android.com/tools/projects/projects-cmdline.html
40 mkdir $HOME/Android/Apps
41 android create project \
44 --path $HOME/Android/Apps/MyFirstApp \
45 --activity MainActivity \
46 --package com.example.myfirstapp
48 # And maybe you want to use git for your App?
49 cd $HOME/Android/Apps/MyFirstApp
53 git rm local.properties
54 git commit -m $'Initial import\n\nhttp://developer.android.com/training/basics/firstapp/creating-project.html'
55 echo "bin/" > .gitignore
56 echo "gen/" > .gitignore
57 echo "local.properties" > .gitignore
59 git commit -m "Add a .gitignore file"
61 # Learn how to write Android Apps:
62 http://developer.android.com/training/basics/firstapp/building-ui.html
65 # http://developer.android.com/tools/building/building-cmdline.html
66 cd $HOME/Android/Apps/MyFirstApp
69 # Start the emulator, hardware accelerated:
70 # http://developer.android.com/tools/devices/emulator.html#vm-linux
71 emulator -verbose -avd android-17-x86 -scale 0.9 -gpu on -qemu -m 512 -enable-kvm
73 # Install the App into an Android [Virtual] Device
75 adb -s emulator-5554 install bin/MyFirstApp-debug.apk
77 # Launch your application from the HOST
78 adb -s emulator-5554 -e shell am start -a android.intent.action.MAIN -n com.example.myfirstapp/com.example.myfirstapp.MainActivity
80 # See logs, e.g. only errors
81 adb -s emulator-5554 logcat *:E
83 # Connect to the emulator via telnet if needed