compile and run Android apps from the console
5,321
I had the same problem until I found a memory error. If you can't upgrade your memory here's what you can do:
-
Install dependencies:
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jdk ant gcc-multilib g++-multilib sudo apt-get install ia32-libs ## if applicable sudo apt-get install ant1.7 ant-optional
-
Export paths:
Open .bashrc file using an editor. If you use VI then
vi ~/.bashrc
and add the following 2 lines in your .bashrc file.JAVA_HOME=/usr/lib/jvm/jdk1.7.0_04/ export JAVA_HOME
Also, you can add these to compile from anywhere:
open: .profile
export PATH=$PATH:~/development/android-sdk-linux/tools export PATH=$PATH:~/development/android-sdk-linux/platform-tools if [ -d "$JAVA_HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi
-
Configure the android simulator:
android avd
And you can setup your simulator there
-
Build:
ant debug
or
ant clean debug
You might need to run:
android update project --target <your build target> --path <path to LunarLander example>
if you get:
Buildfile: build.xml does not exist! Build failed
-
Install the app:
adb install ./bin/app-debug.apk
Sources:
- Updating A Project
- Running On Emulator
- http://developer.android.com/tools/building/building-cmdline.html
Related videos on Youtube
Comments
-
Pat R Ellery over 1 year
I installed eclipse and all the sdk/jre etc... I can make Android Apps now and it's working, but often my eclipse crash.
I would like to know if it's possible to:
- compile
- build
- run
from the command line?
I use VIM to edit the files
-
Pat R Ellery over 10 yearsI tried android studio but it was very slow and crashed too.
-
Jason Conti over 10 yearsIt is possible, they tell you how in the android getting started tutorial: developer.android.com/training/basics/firstapp/… Just jump down to 'Create a Project with Command Line Tools'
-
Pat R Ellery over 10 yearsomg it works, thank you very much ... super fast to build as well +1.