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

  • Eclipse can definitely be a pain. This isn't stable yet, but I've heard good things about Android Studio. It's built on IntelliJ which most people prefer to Eclipse. – konapun Nov 18 '13 at 15:17
  • I tried android studio but it was very slow and crashed too. – Pat R Ellery Nov 18 '13 at 15:24
  • It 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' – Jason Conti Nov 18 '13 at 18:54
up vote 2 down vote accepted
+50

I had the same problem until I found a memory error. If you can't upgrade your memory here's what you can do:

  1. 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
    
  2. 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
    
  3. Configure the android simulator:

    android avd
    

    And you can setup your simulator there

  4. 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
    
  5. Install the app:

    adb install ./bin/app-debug.apk
    

Sources:

  • 1
    omg it works, thank you very much ... super fast to build as well +1. – Pat R Ellery Nov 19 '13 at 12:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.