Search code examples
androidtoolchain

What is the most primitive possible toolchain for android programming?


I feel as though I'm trying to learn android programming in the middle of a fireworks display during a rodeo. All the fancy IDE stuff recommended by all the books I seem to find is just monumentally distracting from discovering what I really and truly need just to develop an android app.

Can anyone point me at documentation for the minimal set of the tools needed to actually build an app? I feel like if I could understand what the heck was actually going on, I'd be better able to use the fancy IDE.


Solution

  • Primitive? So, not Eclipse, and also not ant. You can use aapt, javac, dx, apkbuilder, and signer directly. Or more-or-less directly; you're still a programmer, you have ways of dealing with repetition.

    I do some on-device app development with Terminal IDE. This is one my build scripts (named 'make'):

    P=me/rapacity/stitch
    
    rm src/$P/R.java
    mkdir -m 770 -p dist || exit
    mkdir -m 770 -p build/classes || exit
    mkdir -m 770 -p tmp || exit
    
    ./index.perl
    
    aapt p -f -M AndroidManifest.xml -F build/resources.res \
         -I ~/sdk/3.2/android.jar -S res/ -J src/$P || exit
    
    cd src
    for F in \
        SelectActivity.java Tilesets.java \
            StitchActivity.java \
            TilesetView.java \
    ; do
      if test $P/$F -nt ../build/classes/$P/$(dirname $F)/$(basename $F .java).class; then
        echo Building $P/$F
        REBUILD=1
        javac -d ../build/classes $P/$F 2> ../tmp/javac.out
        ../redcat ../tmp/javac.out
        grep error ../tmp/javac.out && exit
      fi
    done
    cd ..
    
    if [ ! -z $REBUILD ]; then
      set -x
      ( cd src; javac -d ../build/classes $P/R.java )
      ( cd build/classes; dx --dex --verbose --no-strict --output=../core.dex me ) ||  # 'me' as in me.rapacity.
    
      apkbuilder dist/core.apk -u -z build/resources.res -f build/core.dex || exit
      signer dist/core.apk core-debug.apk
    else
      echo +++ No need to rebuild .apk
    fi
    

    in which some lengths are gone to to avoid recompilation and to promptly exit after an error. Very little of that needs to be edited per-project.