Android Questions

February 21 2012
updated April 21,2013

I use Ant on Windows. To set it up:
Download java se and apache ant. If these links don’t work, google “download java se” and “download apache ant”.
Set up a few Environment Variables. I added:
ANDROID_HOME   C:\Users\Earl\Ant\android-sdk
ANT_HOME   C:\apache-ant-1.9.0
JAVA_HOME   C:\Program Files\Java\jdk1.7.0_09

And add ant\bin, java\bin, the sdk-tools and the sdk platform-tools to your path. I added:


To create a project I use the following outline:

android create project --target <target-id> --name MyFirstApp --path <path-to-workspace>/MyFirstApp --activity MainActivity --package com.example.myfirstapp

To find the possible targets I use android list targets

C:\Users\Earl\Documents>android list targets
Available Android targets:
id: 31 or "Google Inc.:Google APIs:17"
     Name: Google APIs
Type: Add-On

I use “Google Inc.:Google APIs:17”.

C:\Users\Earl\Documents\>android create project --target "Google Inc.:Google APIs:17" --name ProgramName --path C:/Users/Earl/Documents/ProgramName --activity ProgramName --package org.nuts4cocos.programname
Created project directory: C:\Users\Earl\Documents\ProgramName

To compile I use ant debug

C:\Users\Earl\Documents\>ant debug

I now move to C:\Users\Earl\Documents\ProgramName

C:\Users\Earl\Documents>cd ProgramName

To install I use adb install [-r] bin/ProgramName-debug.apk
[-r] means reinstall and keep data To just install, leave the -r out.

C:\Users\Earl\Documents\ProgramName>adb install bin/ProgramName-debug.apk
50 KB/s (37558 bytes in 0.723s)
        pkg: /data/local/tmp/ProgramName-debug.apk

T uninstall I use adb uninstall [-k] org.nuts4cocos.programname
[-k] means keep data

C:\Users\Earl\Documents\ProgramName>adb uninstall org.nuts4cocos.programname

Leave a Reply

Your email address will not be published. Required fields are marked *