Scheming with the Coco and Android

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:
%ANT_HOME%\bin;%JAVA_HOME%\bin;
%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;

C:\Users\Earl\Ant\android-sdk\platform-tools>;

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
 ***
C:\Users\Earl\Documents>

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
C:\Users\Earl\Documents\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
Success
C:\Users\Earl\Documents\ProgramName>

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

C:\Users\Earl\Documents\ProgramName>adb uninstall org.nuts4cocos.programname
Success
C:\Users\Earl\Documents\ProgramName>
§238 · By · February 20, 2013 ·


Leave a Reply