- cygwin
- Latest JDK6
- Latest Apache Ant
- Latest Android SDK
- Install cygwin
- Install JDK6 x86
- Install Android SDK: use all-in-one exe installer
- At least select latest API version
- Extract apache-ant zip
On android GUI
- Select "Virtual devices"
- Push "New..." button
- Put entiries the push "Create AVD" e.g.
- "Name" as "android2.3-camera"
- "Target" as "Android 2.3 - API Level 9"
- SD Card "Size" as "32" "MiB"
- Skin "Built-in" as "WVGA854"
- Push Hardware "New..." then select "Camera support" and push "OK" then change value as "yes"
On GUI
- select "android2.3-camera" and press "Start.."
On CUI:
emulator -avd android2.3-camera
avd names will be listed by android list avd
command
run adnroid command as:
android create project -t android-9 \
-p HelloWorld -k net.bellbind.helloworld -a HelloActivity
- -t or --target: target api level (listed by
android list target
command) - -p or --path: created project path
- -k or --package: project package name (at least 3 levels name required)
- -a or --activity: init point Activity class name
(at first, emulator launched):
ant debug
ant install
then the package appeared on emulator app list.
To remove from app list
ant uninstall
Use JDK's keytool for creating a sign key. The key is common for all apk projects. e.g.:
mkdir key
cd key
keytool -genkey -v -keyalg RSA -keysize 2048 -validity 365 \
-keystore apk-release-key.keystore -storepass forstorepass \
-alias forapk -keypass foraliaspass
Input info: name, country (e.g. JP) and more
then files are
- ./key/apk-release-key.keystore
- ./HelloWorld/build.xml
- ./HelloWorld/build.properties
- ...
Add its info to "build.properties"
key.store=../key/apk-release-key.keystore
key.alias=forapk
# option
key.store.password=forstorepass
key.alias.password=foraliaspass
Build release apk:
ant release
then "bin/HelloActivity-release.apk" will be generated
Add commands to ~/.bashrc
function aapt {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/platform-tools/aapt.exe "$@"
}
function adb {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/platform-tools/aapt.exe "$@"
}
function aidl {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/platform-tools/aapt.exe "$@"
}
function dx {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/platform-tools/dx.bat "$@"
}
function android {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/android.bat "$@"
}
function emulator {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/emulator.exe "$@"
}
function hierarchyviewer {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/hierarchyviewer.bat "$@"
}
function layoutopt {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/layoutopt.bat "$@"
}
function mksdcard {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/mksdcard.exe "$@"
}
function monkeyrunner {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/monkeyrunner.bat "$@"
}
function retrace {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/proguard/bin/retrace.bat "$@"
}
function traceview {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/traceview.bat "$@"
}
function zipalign {
TOP=/cygdrive/c/Program\ Files\ \(x86\)/Android/android-sdk-windows
"$TOP"/tools/zipalign.exe "$@"
}
function ant {
export JAVA_HOME=c:/Program\ Files\ \(x86\)/Java/jdk1.6.0_23/
TOP=/cygdrive/d/opt/apache-ant-1.8.2
"$TOP"/bin/ant.bat "$@"
}