2

I am learning how to write an Android application that uses the NDK in order to call OpenCV C++ functions.

I am using Eclipse ADT version 22.3 and NDK R9C.

I have imported the hello-jni sample application from the NDK samples, and it compiles, builds, and runs on my Android device without problems.

However, when I make changes to the project's C source file and rebuild, the changes are not reflected in the build. In fact, I can add a syntactic error into the C file and rebuild, but I get no errors.

Can someone please tell my why the JNI portion of my project is not getting recompiled?

I have tried to import the jni portion into Eclipse as a separate project. But Eclipse does not seem to understand the makefiles in the jni directory. It complains that the makefiles have no "all" targets (which they don't).

jsp
  • 1,225
  • 11
  • 21

1 Answers1

1

When you right-click on your project, can you select Android Tools -> Add Native Support?

Also, under Project Properties -> C/C++ Build is the Use default build command enabled?

Finally, Project Properties -> C/C++ Build -> Behaviour, are the Build (Incremental Build) and Clean options selected?

Dannie
  • 2,430
  • 14
  • 16
  • When I checked for Add Native Support, Eclipse told me that my NDK location was incorrect. I fixed that by following this post, http://stackoverflow.com/questions/11825534/set-build-path-in-eclipse-for-ndk-program, and now everything compiles correctly. Thanks. – jsp Jan 14 '14 at 17:20
  • 1
    I spoke too soon. After fixing the NDK location, I still had to Import the project in the jni directory as a C/C++ application using Android GCC. – jsp Jan 14 '14 at 19:04
  • Actually you could just add ndk-build to auto build properties of Eclipse and that would handle all rebuilding process as you save the cpp files. – eozgonul Jan 15 '14 at 06:41
  • I tried all steps mentioned above .But still the changes are not reflected in android project.Can you resolve this problem? – BABU K Jan 06 '15 at 09:24