Android ndk(cmake): 'undefined reference to `__android_log_write' when using log api in the second jni library

后端 未结 1 1866
南旧
南旧 2021-01-13 05:09

I use Android Studio 2.2 and cmake to build jni file.

I want to show log in jni file but get error message \"undefined reference to `__android_log_write\".

M

相关标签:
1条回答
  • 2021-01-13 05:41

    I finally found I should separated to do the link.

    target_link_libraries( # Specifies the target library.
                       test-lib
                       native-lib
                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )
    
    target_link_libraries( # Specifies the target library.
                       native-lib
                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )
    
    0 讨论(0)
提交回复
热议问题