-2

I use System.loadLibrary to load a *.so file, but I got this error:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android4base10LogMessageC1EPKcjNS0_5LogIdENS0_11LogSeverityES3_i" referenced by "/data/app/com.xx.xx- 2LZ9X_IvwSNdsAL5OnmZ_w==/lib/arm64/libhidlbase.so"

What could cause this? Can you help me?

I also wrote Android source code to get vts case, and when I ran the binary test file on my phone, I also got this problem.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
tianyu
  • 119
  • 1
  • 10
  • I tried to improve your English and your formatting, but I didn't know what you mean by "vts". Could you edit the question and explain that? – Laurenz Albe Jul 05 '19 at 09:57
  • Possible duplicate of [UnsatisfiedLinkError Android](https://stackoverflow.com/questions/21285967/unsatisfiedlinkerror-android) – Shark Jul 05 '19 at 11:13
  • vts is vendor test suite – nurp Aug 23 '19 at 07:07

1 Answers1

0

Looks like you have not linked required target library file 'log'. You need to add the log library as linked library for your *.so file. If you are using CMake, you could add something like this to your CMakeListLists file -

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} )

This example is explained here

Anish
  • 21
  • 1