jni ndk报错 :Error:Execution failed for task ‘:app:compileDebugNdk‘ 如何解决

这个问题是由于NDK引起的,我的IDEA中是没有集成NDK插件的,所以出现了这个问题。其实这个问题并不难解决,以下我将贴出我的解决方案,我的studio版本是1.4的,其他版本也可做参考哈。

defaultConfig//内部添加搞定

sourceSets.main {
    jniLibs.srcDir 'libs'
    jni.srcDirs = []
}
Execution failed for task ':app:buildCMakeDebug[x86_64]'. > com.android.ide.common.process.ProcessException: ninja: Entering directory `D:\xjyWork\SF4310_sof\SF4310_AR\app\.cxx\Debug\5v4l4e3w\x86_64' [1/1] Linking CXX shared library D:\xjyWork\SF4310_sof\SF4310_AR\app\build\intermediates\cxx\Debug\5v4l4e3w\obj\x86_64\libexample.so FAILED: D:/xjyWork/SF4310_sof/SF4310_AR/app/build/intermediates/cxx/Debug/5v4l4e3w/obj/x86_64/libexample.so cmd.exe /C "cd . && C:\Users\32182\AppData\Local\Android\Sdk\ndk\27.0.12077973\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=x86_64-none-linux-android28 --sysroot=C:/Users/32182/AppData/Local/Android/Sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fopenmp=libomp -fno-limit-debug-info -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libexample.so -o D:\xjyWork\SF4310_sof\SF4310_AR\app\build\intermediates\cxx\Debug\5v4l4e3w\obj\x86_64\libexample.so CMakeFiles/example.dir/Reco.cpp.o CMakeFiles/example.dir/JNIReco.cpp.o D:/xjyWork/SF4310_sof/SF4310_AR/app/src/main/cpp/../../../src/libs/x86_64/libncnn.so -lopencv_java4 -landroid -llog -ljnigraphics -latomic -lm && cd ." ld.lld: error: unable to find library -lopencv_java4 clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. * Try: > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. 怎么改
最新发布
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sunxiaopengsun

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值