简体   繁体   English

java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader加载NativeMorphoSmartSDK_6.13.2.0-4.1

[英]java.lang.UnsatisfiedLinkError: Couldn't load NativeMorphoSmartSDK_6.13.2.0-4.1 from loader dalvik.system.PathClassLoader

I am getting null UnsatisfiedLinkError while building my app. 构建我的应用程序时,我得到的是UnsatisfiedLinkError空值。

i am using openssl and some third party libraries to capture finger and verify them. 我正在使用openssl和一些第三方库来捕获手指并进行验证。

here is my cmake file 这是我的cmake文件

  # For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
             native-lib

             # Sets the library as a shared library.
             SHARED

             # Provides a relative path to your source file(s).
             src/main/cpp/native-lib.cpp )


             add_library(openssl SHARED IMPORTED)
             set_target_properties (openssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libcrypto.so )
             set_target_properties (openssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libssl.so )
             set_target_properties (openssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libidkit.so )
             set_target_properties (openssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libjnidispatch.so )
             set_target_properties (openssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libMSO100.so )
             set_target_properties (openssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libNativeMorphoSmartSDK_6.13.2.0-4.1.so )




# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

include_directories(openssl-armeabi-v7a/include/)
find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
                       native-lib
                      ${CMAKE_CURRENT_SOURCE_DIR}/openssl-armeabi-v7a/lib/libcrypto.a
                      ${CMAKE_CURRENT_SOURCE_DIR}/openssl-armeabi-v7a/lib/libssl.a

                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )

is this correct way of loading .so file in cmake or is there any method to load .so files . 是在cmake中加载.so文件的正确方法,还是有任何方法加载.so文件。 help with this issue 帮助解决这个问题

Each .so file that you list is a separate library. 您列出的每个.so文件都是一个单独的库。 You must give each a separate name, eg 您必须给每个单独的名称,例如

add_library(foo SHARED IMPORTED)
set_target_properties (foo PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libcrypto.so )
add_library(prebuilt_ssl SHARED IMPORTED)
set_target_properties (prebuilt_ssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libssl.so )
add_library(idkit SHARED IMPORTED)
set_target_properties (idkit PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/lib/libidkit.so )

and so on. 等等。 As you can see above, the logical name is not necessarily related to the file name. 正如您在上面看到的,逻辑名不一定与文件名相关。

If your native-lib depends on some of them, you can use these names: 如果您的本机库依赖于其中的某些 ,则可以使用以下名称:

target_link_libraries( # Specifies the target library.
    native-lib foo prebuilt_ssl
    # Links the target library to the log library
    # included in the NDK.
    log )

Note that with NDK, you don't need find_library to add dependency on the android log library. 请注意,使用NDK,您不需要find_library即可添加对android日志库的依赖关系。


There is some self-contradiction in the CMake script that you posted. 您发布的CMake脚本中存在一些自相矛盾之处。 You should use OpenSSL libraries either as shared objects (as libssl.so ), or static libraries (as libssl.a ), but not both. 您应该将OpenSSL库用作共享库(如libssl.so )或静态库(如libssl.a ),但不能同时使用。 It's OK to mix libjnidispatch.so together with libssl.a , but not libcrypto.a and libssl.so . 可以将libjnidispatch.solibssl.a混合在一起,但不能将libcrypto.alibssl.so混合在一起。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader加载echoprint-jni - java.lang.UnsatisfiedLinkError: Couldn't load echoprint-jni from loader dalvik.system.PathClassLoader 由以下原因引起:java.lang.UnsatisfiedLinkError:无法从加载器dalvik.system.PathClassLoader findLibrary加载gnustl_shared返回null - Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gnustl_shared from loader dalvik.system.PathClassLoader findLibrary returned null java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader加载和enginephysicsbox2dextension…findLibrary返回null - java.lang.UnsatisfiedLinkError: Couldn't load andenginephysicsbox2dextension from loader dalvik.system.PathClassLoader… findLibrary returned null 无法加载vlcjni库:java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList找不到“ libvlcjni.so” - Can't load vlcjni library: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList couldn't find “libvlcjni.so” java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader - java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList ...]找不到“libdetection_based_tracker.so” - java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList…] couldn't find “libdetection_based_tracker.so” java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList - java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList PID:15208 java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader - PID: 15208 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader Android java.lang.UnsatisfiedLinkError dalvik.system.PathClassLoader - Android java.lang.UnsatisfiedLinkError dalvik.system.PathClassLoader 设置为系统应用程序时,无法从加载程序dalvik.system.PathClassLoader加载硬件打印 - Couldn't load hardware-print from loader dalvik.system.PathClassLoader when set as system app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM