Android JNI项目build时报告missing and no known rule to make it的原因
出错信息:
> Task :app:buildCMakeRelWithDebInfo FAILED
C/C++: ninja: error: '~/Documents/MyApp/MacApp/InfoScan/app/PaddleLite/cxx/libs/arm64-v8a/libpaddle_light_api_shared.so', needed by '/Users/zhudongning/AndroidStudioProjects/Test_Opencv1/app/build/intermediates/cxx/RelWithDebInfo/1s735c67/obj/arm64-v8a/libtest_opencv1.so', missing and no known rule to make it
跟踪了一整天不得要领,最后发现原因是 “cmake不喜欢相对路径”
原来在CMakelists.txt里包含第三方库的路径是:
set(PaddleLite_DIR “~/Documents/MyApp/MacApp/InfoScan/app/PaddleLite")
须改为绝对路径:
set(PaddleLite_DIR "/Users/zhudongning/Documents/MyApp/MacApp/InfoScan/app/PaddleLite")