3

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

  1. Running on Mac OS X Mountain Lion 10.8.2, Eclipse Juno, gcc 4.2.1, GNU Make 3.8.1.
  2. My project is a test project to learn NDK, targets API 16 , intending to support API 8 and above.
  3. My project is at path ~/Desktop/PROJECT/ANDROID/WORKSPACE/NDKResearch.
  4. 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?

Community
  • 1
  • 1
Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
  • Do you get the problem even if you remove APP_PROJECT_PATH := /Users/myusername/Desktop/PROJECTS/ANDROID/WORKSPACE/NDKResearch from Application.mk? – Ryan Maloney Dec 19 '12 at 17:21
  • 1
    One thing I notice is that you are using gnustl for RTTI and exceptions but your source files end in .c which, to my knowledge, results in compilation from gcc instead of g++. I don't know if this would result in the error message you are getting but it may be worth either naming the source files to a recognized cpp extension (although there is an issue with 8, see here LOCAL_CPP_EXTENSION) or add LOCAL_CPP_EXTENSION := .c – Ryan Maloney Dec 20 '12 at 03:24

1 Answers1

-1

What worked for me was putting the following line in my .bashrc

export NDK_PROJECT_PATH="."

then typing source ~/.bashrc and ndk-build in the project directory.

wtabib
  • 19
  • 1