How do you add an existing .so library to an Android Studio project?

前端 未结 2 1294
粉色の甜心
粉色の甜心 2021-01-20 22:05

There are several sources out there that say you should create a directory in src/main/ called jniLibs/armeabi and add your compiled .so file to this location. Then load you

相关标签:
2条回答
  • 2021-01-20 22:48

    to solve that problem, just follow this steps and visit a link below:

    Adding .so Library in Android Studio 1.0.2

    1. Create Folder "jniLibs" inside "src/main/"
    2. Put all your .so libraries inside "src/main/jniLibs" folder
    3. Folder structure looks like,
      |--app:
      |--|--src:
      |--|--|--main
      |--|--|--|--jniLibs
      |--|--|--|--|--armeabi
      |--|--|--|--|--|--.so Files
    4. No extra code requires just sync your project and run your application.

      Reference
      https://github.com/commonsguy/sqlcipher-gradle/tree/master/src/main

    From: How to include *.so library in Android Studio?

    EDIT: I suppose that might not be problem with configuration, but with how you declare native method signatures in Android NDK

    Check this link: What is the correct way to write native method signatures in Android NDK?

    Hope it help

    0 讨论(0)
  • 2021-01-20 23:07

    Turns out I can still call the jni methods even though there is an error saying "Cannot resolve corresponding JNI function".

    0 讨论(0)
提交回复
热议问题