Well, I have seen 4 similiar questions in stackoverflow (this, this, this and this). And I tried the answers given there. I must say one answer worked for me, but the documentation clearly say not to use that method. So here I am asking..
My project setup
- Running on Mac OS X Mountain Lion 10.8.2, Eclipse Juno, gcc 4.2.1, GNU Make 3.8.1.
- My project is a test project to learn NDK, targets API 16 , intending to support API 8 and above.
- My project is at path
~/Desktop/PROJECT/ANDROID/WORKSPACE/NDKResearch
. - My NDK path is
~/Documents/ANDROID/android_ndk_r8a
I don't know how path information helps. But I always had problems giving correct path in bash. So just posting it here.
What I have done?
In my NDKResearch project I added an Android.mk
file (path : $MY_PROJECT_PATH/jni/Android.mk
)
include $(CLEAR_VARS)
LOCAL_PATH:= $(call my-dir)
LOCAL_CPP_FEATURES += -fno-exceptions
LOCAL_SRC_FILES := \
Log.c \
Calculate.c
LOCAL_MODULE := libSoundTouch
include $(BUILD_SHARED_LIBRARY)
Added an Application.mk
file in $MY_PROJECT_PATH/jni/Application.mk
.
APP_PLATFORM := android-16
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_PROJECT_PATH := /Users/myusername/Desktop/PROJECTS/ANDROID/WORKSPACE/NDKResearch
And then I executed ndk-build
in bash shell
## cd ~/Desktop/PROJECT/ANDROID/WORKSPACE/NDKResearch
## ~/Documents/ANDROID/android_ndk_r8a/ndk-build
only to get the error mentioned in title.
What my question is?
From the above linked threads, user sege's answer did work for me. None of the others did. But documentation for ndk clearly states not to use this method. From Overview.html file shipped with ndk (could not find an online version).
There are two ways to use an Application.mk:
Place it under $PROJECT/jni/Application.mk, and it will be picked up automatically by the 'ndk-build' script (more on this later)
Place it under $NDK/apps//Application.mk, where $NDK points to your NDK installation path. After that, launch "make APP=" from the NDK directory.
This was the way this file was used before Android NDK r4. It is still supported for compatibility reasons, but we strongly encourage you to use the first method instead, since it is much simpler and doesn't need modifying / changing directories of the NDK installation tree.
So my question is, Has anybody had success with the first method? Any reason why it is not working?