Integrating MuPDF as a library project (Android)

后端 未结 2 723
野性不改
野性不改 2021-01-18 03:49

So I have built this project based on a pdf reader(MuPDF). I used ndk-build for that. The name of this project is ChoosePDFActivity. I know that it has been correctly built

相关标签:
2条回答
  • 2021-01-18 04:30

    You just have to create a dummy dynamic library that simply links against your static library like this:

    https://stackoverflow.com/a/2957386/892714

    The ndk build system (unfortunately) will not create a static library without it being used by a dynamic library. Then you simply grab your static library from obj/local/armeabi-v7a.

    0 讨论(0)
  • 2021-01-18 04:38

    You do not really need any NDK magic because if your project has no jni/ folder, and if you place the libraries in the libs/, they will be there. (Just in case, put them under version control; by default .so is usually ignored.)

    The most important line in your log is:

    Caused by: java.lang.UnsatisfiedLinkError: Couldn't load libmupdf
    

    If your project uses two libraries, you have to load both, in the order that would resolve dependencies.

    static {
        System.loadLibrary("tools"); // libtools.so
        System.loadLibrary("main"); // libmain.so
    }
    

    As I understand, you have no linker problems, but just in case I post these links:
    Re: How to build an shared library and call it in other ndk program
    Android NDK - make two native shared libraries calling each other
    Android NDK: Link using a pre-compiled static library

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