Android Jni问题整理

1.Build command failed.
Error while executing process E:\Develop\Android\sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C E:\Project\Android\test\PlayDemo\app\.cxx\Debug\59271j4o\arm64-v8a playdemo}
ninja: Entering directory `E:\Project\Android\test\PlayDemo\app\.cxx\Debug\59271j4o\arm64-v8a'
ninja: error: 'E:/Project/Android/test/PlayDemo/app/src/main/cpp/libs/arm64-v8a/libavcodec.so', needed by 'E:/Project/Android/test/PlayDemo/app/build/intermediates/cxx/Debug/59271j4o/obj/arm64-v8a/libplaydemo.so', missing and no known rule to make it

需要在CmakeLists.txt文件中添加绝对路径


2 files found with path 'lib/arm64-v8a/libavcodec.so' from inputs:
- E:\Project\Android\test\PlayDemo\app\build\intermediates\merged_jni_libs\debug\out\arm64-v8a\libavcodec.so
- E:\Project\Android\test\PlayDemo\app\build\intermediates\cxx\Debug\59271j4o\obj\arm64-v8a\libavcodec.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets

解决条款:这是因为在 build.gradle 配置的jniLibs.srcDirs文件冲突引起的,gradle 版本较高不需要手动指定so库的路径,删除即可

posted @ 2023-02-01 09:27  西瓜皮不甜  阅读(896)  评论(0编辑  收藏  举报