I have a large source tree with multiple projects. One of the projects uses JNI.
When I try to "make clean" on my entire source tree it goes through and removes all the object files and libs. Then it steps into my applications directory to make clean.
When it gets to my JNI project it executes "ndk-build clean" which fails because the library I link against has been removed as part of the clean:
ndk-build clean
Android NDK: ERROR:/Users/spartygw/xyz/src/applications/foo/jni/Android.mk:bar: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /Users/spartygw/xyz/src/applications/foo/jni/../../../../lib/libbar.a exists or that its path is correct
/Users/spartygw/android-ndk-r6b/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
make[3]: *** [clean_android] Error 2
make[2]: *** [clean] Error 2
make[1]: *** [clean] Error 2
make: *** [clean] Error 2
I've tried adding "ndk-build -k clean" and "ndk-build --ignore clean" but it bails out regardless.
How can I make ndk-build ignore the dependency on the libraries that are not yet built and just clean the local objects?
Your ndk-buid includes prebuit static library, which is not supposed to disappear even in clean build. There is some non-standard step that builds libbar.a and copies it to
../../../../lib/
.If you have strong reasons not to link to libbar.a directly from the place where it's built (
…/obj/local/armeabi
), then you have two options: eitherinclude $(PREBUILT_STATIC_LIBRARY)
conditionally if its $(LOCAL_SRC_FILES) is present, or if clean is not the target.Follows a simple outline of the former approach: