Recently I'm back in java land, more specifically android. The past few months I've exclusively been doing scripting languages using much more primitive editors (textmate, emacs). Going back to java, I'm finding Eclipse is just getting in my way. So I decided to try and develop an android app using textmate and found it incredibly easy. It appears you have everything you need from the command line tools and all the eclipse plugin does is interface with those.
Step 1, create your project
THis couldn't be easier:
android create project --target 2 --name install_test --path . --activity InstallTest --package com.jonandkerry.install
Obviously make sure your android sdk is in your path. NOTE: if you are using SNow leopard you will need to patch your android install. See here
Step 2, build your project
The android create project tool actually builds you a very simple java skeleton project with an ant build.xml. You get several targets:
aidl
android_rules.aidl
android_rules.compile
android_rules.debug
android_rules.debug-sign
android_rules.dex
android_rules.dirs
android_rules.help
android_rules.install
android_rules.no-sign
android_rules.package
android_rules.package-resources
android_rules.release
android_rules.release-package
android_rules.release.check
android_rules.release.nosign
android_rules.resource-src
android_rules.uninstall
android_rules.uninstall.check
android_rules.uninstall.error
compile
debug
debug-sign
dex
dirs
help
install
no-sign
package
package-resources
release
release-package
release.check
release.nosign
resource-src
uninstall
uninstall.check
uninstall.error
Default target: help
obviously you see and "ant compile", "ant install", etc. Its important to note that ant compile will generate the R.java resource just like eclipse does.
Step 3, run
Couldn't be easier.
$ ant install
Buildfile: build.xml
[setup] Project Target: Android 1.6
[setup] API level: 4
dirs:
[echo] Creating output directories if needed...
resource-src:
[echo] Generating R.java / Manifest.java from the resources...
[exec] (skipping hidden file '/Users/jonathan/Development/personal/install_test/res/.DS_Store')
[exec] (skipping hidden file '/Users/jonathan/Development/personal/install_test/res/layout/.DS_Store')
aidl:
[echo] Compiling aidl files into Java classes...
compile:
[javac] Compiling 1 source file to /Users/jonathan/Development/personal/install_test/bin/classes
dex:
[echo] Converting compiled files and external libraries into bin/classes.dex...
package-resources:
[echo] Packaging resources
[aaptexec] Creating full resource package...
[null] (skipping hidden file '/Users/jonathan/Development/personal/install_test/res/.DS_Store')
[null] (skipping hidden file '/Users/jonathan/Development/personal/install_test/res/layout/.DS_Store')
debug-sign:
package:
[apkbuilder] Creating install_test-debug-unaligned.apk and signing it with a debug key...
[apkbuilder] Using keystore: /Users/jonathan/.android/debug.keystore
[apkbuilder] /Users/jonathan/Development/personal/install_test/bin/classes.dex => classes.dex
debug:
[echo] Running zip align on final apk...
[echo] Debug Package: bin/install_test-debug.apk
install:
[echo] Installing bin/install_test-debug.apk onto default emulator...
[exec] 317 KB/s (10728 bytes in 0.032s)
[exec] pkg: /data/local/tmp/install_test-debug.apk
[exec] Success
BUILD SUCCESSFUL
Total time: 5 seconds
And there you go. To be honest, I'd much rather run this stuff from the command line than watch the spinning beach ball in eclipse.
For more things you can do, see the official documentation:
And also, there is a textmate plugin that simply runs a few of these tasks:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment