Friday 20 November 2009

Moving to Android NDK 1.6 from Android NDK 1.5 ...

I've updated my Android configuration to NDK 1.6, and am using the latest STLPort download.

There were a few things that changed, mainly system paths, as some posters to my blog were kind enough to point-out in earlier posts.

Here are some notes on that process, from the point of view of a cygwin-based setup under Windows. The comments generally apply to Linux/Mac as well, however.

Getting STLPort

I performed the "git" command for STLPort from within the root of the Android NDK folder, in other words from within this folder:

C:\android-ndk-1.6_r1

The command to use is this:

git clone git://umbel.mooo.com/ndk-wrappers.git

This puts the STLPort code in a slightly different place to where it was before, such that the code appears under the ndk-wrappers folder...


ndk-wrappers\stlport


... which you'll need to account for when you update the paths!

There were a couple of other things that I found tricky to get right in this transition were as follows.

env.sh

When you try running env.sh, you must do it with "source" otherwise the environment isn't updated properly. In other words, type this:

source ./env.sh


Application.mk

If your project is called "fred", then you need to have the following folder:

C:\android-ndk-1.6_r1\apps\fred

This should contain just one item, which is the Application.mk file, with the following (example!) two lines in it:

APP_PROJECT_PATH := /cygdrive/c/DOCUME~1/me/MYDOCU~1/WORKSP~1/fred
APP_MODULES := fred

libstlport.a

Once you've rebuilt STLPort, you need to copy libstlport.a (which seemed to be called libstlport.5.1.a in the previous build system... again, watch out for that!) to a new folder, which you'll need to create in the following location:

C:\android-ndk-1.6_r1\out\apps\fred\libs

The jni folder

You need to have at least two files (your source .cc file, and your Android.mk file) in the jni folder under your project, which is here in my example:

C:\Documents and Settings\me\My Documents\workspace\fred\jni

Android.mk

In my example, the Android.mk file contains this data:


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

STLPORT_BASE := /cygdrive/c/android-ndk-1.6_r1/ndk-wrappers/stlport


LOCAL_MODULE := fred
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS += -I$(STLPORT_BASE)/stlport \
-D__NEW__ \
-D__SGI_STL_INTERNAL_PAIR_H \
-DANDROID \
-DOS_ANDROID
LOCAL_SRC_FILES := fred.cc

#Static Libraries:
LOCAL_PREBUILT_LIBS := libs/libstlport.a
include $(BUILD_MULTI_PREBUILT)
LOCAL_STATIC_LIBRARIES := libs/libstlport

include $(BUILD_SHARED_LIBRARY)


Good luck!

That should be enough to get you up-and-running with NDK 1.6!

Wednesday 4 November 2009

Mixtikl 2 - coming December 8th 2009

The Mixtikl 2 release date has now been set at December 8th 2009.

Can't wait! :)