How To Create .apk File Without Using Eclipse
Solution 1:
The best way I have found to create .apk without eclipse, or without any other IDE is to use maven with this neat plugin : Maven-Android-Plugin. It is actively maintained and quite well documented. You can start off with a sample.
The downside of this approach is that one has to change the build process and not every dirty little detail is hidden by the IDE.
The upsides are a full control of the build, signing, code audits, CI integration and the free choice of the IDE.
Solution 2:
In a project prepared by the SDK's tools, you can build an .apk with ant debug
, to start.
You can also learn to directly use the SDK tools, and automate what you've learned with Makefiles or scripts. Terminal IDE, a market app that provides an on-device development environment, does so without ant, or make, or more involved build systems, so its example projects come with scripts that directly call javac, dx, aapt. For example, one of my build scripts under this system:
set -x
P=net/rapacity/wizardry
rm src/$P/R.java
mkdir -m 770 -p dist || exitmkdir -m 770 -p build/classes || exit
aapt p -f -M AndroidManifest.xml -F build/resources.res \
-I ~/system/classes/android.jar -S res/ -J src/$P || exitcd src
for F in \
sokoban2/{Maze,TileView,MazeActivity}.java \
R.java Maze.java EmptyActivity.java {emptyquiet,gadgets,sokoban}/Maze{,Activity}.java \
; doecho$F > ~/tmp/.remake
javac -d ../build/classes $P/$F 2> ~/tmp/javac.out
../redcat ~/tmp/javac.out
grep error ~/tmp/javac.out && exitdonecd ..
( cd build/classes; dx --dex --verbose --no-strict --output=../core.dex net ) || exit
apkbuilder dist/core.apk -u -z build/resources.res -f build/core.dex || exit
signer dist/core.apk core-debug.apk
All that fussing with redcat, javac.out, et al., is to interrupt the build on an error (javac unhelpfully returns 0 no matter the success), and to allow a quick re-do of the last-attempted compile, to see if errors have been fixed. ant, maven, even a reasonable use of make, will provide this stuff for you.
Post a Comment for "How To Create .apk File Without Using Eclipse"