在 Android Studio 中添加 .so 文件 [英] Adding a .so file in Android Studio

查看:45
本文介绍了在 Android Studio 中添加 .so 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加一个外部库 Scandit.我不断收到此错误:

I am trying to add an external library, Scandit. I keep getting this error:

    java.lang.UnsatisfiedLinkError: Couldn't load scanditsdk-android-3.3.1 from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.clover.barcode2-1.apk,libraryPath=/data/app-lib/com.clover.barcode2-1]: findLibrary returned null
    at java.lang.Runtime.loadLibrary(Runtime.java:365)
   .....

我认为这是因为我没有正确包含库附带的 .so 文件,但我不知道如何去做.

I assume it is because I am not properly including the .so file that comes with the library, but I can't figure out how to do it.

我正在使用 Android Studio,我通过转到模块设置 -> 库添加了库,并添加了包含 jar 的目录和包含 so 文件的目录.

I am using Android Studio and I added the library by going to module settings -> libraries and added the directory with the jar and the directory with the so file.

推荐答案

您可以使用 gradle 0.7.2+ 在 Android Studio 中添加预构建的 *.so 文件.首先在/app/src/main/这个位置创建jniLibs,复制jniLibs中所有带有*.so文件的文件夹(armeabi、armeabi-v7a、mips、x86).

You can add pre built *.so files in Android Studio using gradle 0.7.2+. First create the jniLibs at this location /app/src/main/ location and copy the all the folder with *.so files (armeabi, armeabi-v7a, mips, x86) in the jniLibs.

这篇关于在 Android Studio 中添加 .so 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆