簡體   English   中英

使用 System.loadLibrary 時出現錯誤“找不到符號”

[英]error "cannot locate symbol" when using System.loadLibrary

我使用System.loadLibrary加載*.so文件,但出現此錯誤:

java.lang.UnsatisfiedLinkError:dlopen 失敗:無法找到符號“_ZN7android4base10LogMessageC1EPKcjNS0_5LogIdENS0_11LogSeverityES3_i”引用的“/data/app/com.xx.xx- 2LZ9X_IvwSNdsAL5OnmZarmllib.4==”

什么可能導致這種情況? 你能幫助我嗎?

我也寫了Android源碼弄到vts case,在手機上運行二進制測試文件的時候也出現了這個問題。

看起來您尚未鏈接所需的目標庫文件“日志”。 您需要將日志庫添加為 *.so 文件的鏈接庫。 如果您使用的是 CMake,則可以在 CMakeListLists 文件中添加類似的內容 -

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 )


target_link_libraries( # Specifies the target library.
                       your_so_file_name

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

這個例子解釋here

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM