Native libraries (.so files) are not added to an android project

前端 未结 3 1339
失恋的感觉
失恋的感觉 2021-02-08 21:37

I\'m trying to use sqlitecipher library which requires using native libraries. Their tutorial is very simple but it doesn\'t work for me. Every time I get the following error:

相关标签:
3条回答
  • 2021-02-08 21:45

    You have to create jni folder for .so file include in android project using android studio.

    I have attached image please follow these steps.

    After creating jnilib folder you can put your all .so files in this folder.

    0 讨论(0)
  • 2021-02-08 21:49

    To Question 1: Yes. I haven't had this specific problem before, but genearlly you don't need to swich to gradle. It is possible to use an ant task to add SO files to an APK. And since maven can run Ant tasks it possible.

    The nativeLibsToJar that you found here is nothing else than a task that puts all the SO files into a ZIP file and then uses the extension JAR instead of ZIP. You can easily do that with the Ant task Zip (and maybe additionally rename).

    To Question 2: No. Because of the first answer. There is no need for "maven to support native libraries". Just use Ant as build-system.

    0 讨论(0)
  • 2021-02-08 22:01

    As soon as the native libs are in /libs/armeabi/ all you have to do is to configure the android plugin properly. Something like this:

    <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <configuration>
             <nativeLibrariesDirectory>${project.basedir}/libs</nativeLibrariesDirectory>
             ...
        </configuration>
        <extensions>true</extensions>
    </plugin>
    
    0 讨论(0)
提交回复
热议问题