2

I'm playing around sample application provided in the Android NDK kit.

I imported the Native audio example code. When I tried to some changes in .cpp file, it'll start showing unresolved inclusion for all includes and compilation errors. Has anyone faced this issue?

When I build the project ndk-build successfully builds .so file.

Android.mk file is as follows

LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE    := native-audio-jni
    LOCAL_SRC_FILES := native-audio-jni.c
    # for native audio
    LOCAL_LDLIBS    += -lOpenSLES
    # for logging
    LOCAL_LDLIBS    += -llog
    # for native asset manager
    LOCAL_LDLIBS    += -landroid

    include $(BUILD_SHARED_LIBRARY)

Logs on Console are as follows.

12:01:55 ** Build of configuration Default for project NativeAudio ** "C:\android-ndk\ndk-build.cmd" all "Compile thumb : native-audio-jni <= native-audio-jni.c SharedLibrary : libnative-audio-jni.so Install : libnative-audio-jni.so => libs/armeabi/libnative-audio-jni.so 12:01:56 Build Finished (took 1s.242ms)

ARP
  • 603
  • 1
  • 11
  • 23
  • paste the logs of console. – Yuvi Feb 27 '14 at 06:42
  • 12:01:55 **** Build of configuration Default for project NativeAudio **** "C:\\android-ndk\\ndk-build.cmd" all "Compile thumb : native-audio-jni <= native-audio-jni.c SharedLibrary : libnative-audio-jni.so Install : libnative-audio-jni.so => libs/armeabi/libnative-audio-jni.so 12:01:56 Build Finished (took 1s.242ms) – ARP Feb 27 '14 at 06:44
  • Please add those as a part of question, it shows that library is compiled successfully, where you are facing compilation error then? – Yuvi Feb 27 '14 at 06:49
  • Paste your Android.mk ,paste it in Question itself. – Yuvi Feb 27 '14 at 07:13
  • 2
    Are you using Eclipse? There's known issues with the Eclipse C++ indexer when using the Android plugin – krsteeve Feb 27 '14 at 16:52
  • Your problem statement has some issues - you can't really say that it successfully builds **and** that it has unresolved inclusion and compile errors. If these mutually exclusive results come from different versions of the code, or *different build methods* then you need to say so. – Chris Stratton Feb 27 '14 at 17:22

1 Answers1

1

Has anyone faced this issue?

The answer is strong positive:

… and more. Unfortunately, none of the solutions, even those accepted, is trustworthy. If you want a simple, limited, but sure remedy, simply disable the indexer.

Update

There is a workaround which involves switching the indexer from Android GCC toolchain to Linux GCC toolchain, see https://stackoverflow.com/a/22647256/1525238, or https://stackoverflow.com/a/22935387/1525238.

Community
  • 1
  • 1
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • 1
    See my answer here http://stackoverflow.com/a/22935387/1525238 for complete indexing capability. I see you have a similar answer here http://stackoverflow.com/a/22647256/1525238 and I think that's trustworthy enough given that it works properly. – Ayberk Özgür Apr 08 '14 at 11:25