cc_library_shared { name: "libDesensitisejni", cflags: [ "-Werror", "-Wno-error=unused-parameter", ], include_dirs: ["."], srcs: ["jni/Jni_Desensitis.cpp"], shared_libs: [ "libEGL", "libGLESv2", "libjpeg", "libprotobuf", "libTSDesensitizationAlgorithm", "libecarx_engine", ], sdk_version: "current", arch: { arm: { instruction_set: "arm", }, }, }报错dependency "libjpeg" of "libDesensitisejni" missing variant
时间: 2023-08-12 15:08:12 浏览: 167
这个错误是由于在编译 "libDesensitisejni" 时,找不到符合指定条件的 "libjpeg" 库的变体。具体来说,你的系统中可能没有符合条件的 "libjpeg" 库或者是这个库的变体不匹配。你需要检查你的系统中是否有符合条件的库,并且确保它们的变体与编译 "libDesensitisejni" 所需的变体匹配。你可以尝试更新或安装相应的库来解决这个问题。
相关问题
android_app { name: "DesensitiseJNI", srcs: ["**/*.java"], sdk_version: "current", jni_libs: ["libDesensitisejni"], } // Build JNI Shared Library cc_library_shared { name: "libDesensitisejni", cflags: [ "-Werror", "-Wno-error=unused-parameter", ], include_dirs: ["."], srcs: ["jni/Jni_Desensitis.cpp"], shared_libs: [ "libEGL", "libGLESv2", "libjpeg", "libprotobuf", "libTSDesensitizationAlgorithm", "libecarx_engine", ], sdk_version: "current", arch: { arm: { instruction_set: "arm", }, }, }转为CMake
以下是将上述 Android.mk 转换为 CMakeLists.txt 的示例:
```
cmake_minimum_required(VERSION 3.4.1)
add_library(DesensitiseJNI SHARED
src/main/java/com/example/DesensitiseJNI.java
jni/Jni_Desensitis.cpp)
target_include_directories(DesensitiseJNI PRIVATE .)
target_link_libraries(DesensitiseJNI
libEGL
libGLESv2
libjpeg
libprotobuf
libTSDesensitizationAlgorithm
libecarx_engine)
target_compile_options(DesensitiseJNI PRIVATE
-Werror
-Wno-error=unused-parameter)
set_target_properties(DesensitiseJNI PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON)
# Set the ABI for the library
set_target_properties(DesensitiseJNI PROPERTIES
ANDROID_ARM_MODE "arm")
```
请注意,这只是一个示例,你需要根据你的项目结构和需要进行适当的修改。
android_app { name: "DesensitiseJNI", srcs: ["**/*.java"], sdk_version: "current", jni_libs: ["libDesensitisejni"], } // Build JNI Shared Library cc_library_shared { name: "libDesensitisejni", cflags: [ "-Werror", "-Wno-error=unused-parameter", ], include_dirs: ["."], srcs: ["jni/jpgDesensitise.cpp"], shared_libs: [ "libEGL", "libGLESv2", "libjpeg", "libprotobuf", "libTSDesensitizationAlgorithm", "libecarx_engine", ], sdk_version: "current", arch: { arm: { instruction_set: "arm", }, }, }有错误吗
从代码来看,没有明显错误。但是需要检查以下几点:
1. 检查 `srcs` 中的源文件路径是否正确。
2. 检查 `jni_libs` 中的库是否已经正确编译。
3. 检查 `shared_libs` 中的库是否已经正确编译,并且是否包含所需的变体。
4. 检查 `include_dirs` 中的路径是否正确。
如果以上几点都没有问题,尝试清除构建缓存并重新编译。如果还是无法解决问题,建议提供更详细的错误信息。
阅读全文