问题
I'm attempting to upgrade from ndk-r11c to ndk-r14. When I run r14, I get an error
Android NDK: Module myJNI depends on modules: png jpeg log
In my Android make: LOCAL_SHARED_LIBRARIES := png jpeg log
回答1:
Assuming you didn't copy the full error message and it actually said "depends on undefined modules", check the release notes:
Module builds will now fail if they have any missing dependencies. To revert to the old behavior, set APP_ALLOW_MISSING_DEPS=true. See https://github.com/android-ndk/ndk/issues/208.
liblog shouldn't be in LOCAL_SHARED_LIBRARIES. You want LOCAL_LDLIBS := -llog instead. Although, actually, if this warning is firing but your project was building you're not using it anyway.
libjpeg and libpng don't appear to be defined in your project. Just remove them since they can't have been used anyway.
回答2:
I also got this error, but for a different reason.
The build environment was hosted on Windows, and the project being build was in a deep directory. Due to Windows path size limitation, it was not possible to find the necessary module.
So I solved it building the project in a high level path (such as D:\), to make sure the path sizes wouldn't be a problem.
回答3:
Met similar error with OpenCV Android SDK 3.1 which missing opencv_legacy module
/home/jenkins/android-ndk-r15c/build/core/build-binary.mk:688: Android NDK: Module TestProject depends on undefined modules: opencv_legacy
Add the following line to the src/main/jni/Application.mk resolve the problem, thanks @Dan Albert
APP_ALLOW_MISSING_DEPS=true
来源:https://stackoverflow.com/questions/42706917/undefined-modules-when-switching-to-a-newer-version-of-android-ndk