Android NDK, CMake with other libraries

后端 未结 2 1116
攒了一身酷
攒了一身酷 2021-02-07 11:49

So I am trying to build and test out a CMake with the Android NDK on Android Studio. I can get my library to compile, but it doesn\'t seem to want to pull any third-party depend

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-07 12:28

    May you add more info for: "but it doesn't seem to want to pull any third-party dependencies over."?

    this one:
    https://github.com/googlesamples/android-ndk/tree/master/hello-libs has static and shared 3rd party libs, you may try it.

    For the shared dependent lib, you will need to pack them into APK, that is done inside gradle, cmake will not do it.
    The above example shows that, basically they need to be copied into your app/src/main/jniLibs too so they will be packed into apk, and pushed to your android phone/tablet. At runtime they could be loaded.
    I have tried to put a group of libraries into one directory, and use

    • link_directories(...)

    then just put the lib names directly into

    • target_link_libraries(...)

    also works. Make sure you have the right libs for the ABIs you intend to support for your app [looks like you are just building for one ABI].

提交回复
热议问题