Android NDK: Missing LOCAL_MODULE before enabling BUILD_SHARED_LIBRARY

I am trying to set up an NDK test project in Eclipse / ADT following this tutorial .

I created a new new Android project "Test1" to which I added these 2 files:

c: \ Workspace \ Test1 \ jni \ Android.mk
c: \ Workspace \ Test1 \ jni \ ndkfoo.c

It's in Android.mk

:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := ndkfoo
LOCAL_SRC_FILES := ndkfoo.c
include $(BUILD_SHARED_LIBRARY)

      

But when I try to compile it I get this error:

c: \ Workspace \ Test1 \ jni> ndk-build
c: /android-ndk-r10d/build/core/build-shared-library.mk: 23: *** Android NDK: Missing LOCAL_MODULE before including BUILD_SHARED_LIBRARY in c: /Workspace/Test1//jni/Android.mk. Stop.

But I have a suggestion LOCAL_MODULE    := ndkfoo

in Android.mk

, so I don't understand why I am getting this error!

+3


source to share


1 answer


Going through this, if some other poor soul tries to copy / paste directly from this tutorial - there is something wrong with spaces on the line LOCAL_MODULE := ndkfoo

.

I think these are not valid spaces, but some weird Unicode character messing around with ndk-build because I was looking at them with a hex editor and they were 0xC2 0xA0 0xC2 0xA0 0xC2 0xA0

instead 0x20 0x20 0x20 0x20

(these are normal spaces).

Any copying from their tutorial will have this error unfortunately.



If you try to copy from the question here it should be OK, I think SO somehow captured them in normal spaces, but on the original site they are weird Unicode spaces that will lead to an error ndk-build

.

Edit: Apparently these are non-breaking spaces . I don't know if this is true, but I think ndk-build did not recognize them as whitespace, so they became part of the variable name, so I was defining a variable with a name "LOCAL_MODULE "

instead "LOCAL_MODULE"

, which is why it complained about the undefined variable.

+5


source







All Articles