加载.so库时出现问题

时间:2015-03-03 09:08:46

标签: java android bass bass.dll

我有一个android项目(Inellij IDEA)。我从官方网站下载BASS库,并将lib文件夹中的内容复制到我的项目文件夹libs/。但是当我尝试使用System.loadLibrary("bass");加载它时,会抛出错误:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip
file "/data/app/com.negi.opengltest-1/base.apk"],nativeLibraryDirectories=
[/vendor/lib, /system/lib]]] couldn't find "libbass.so"

我做错了什么?也许,我需要更改gradle配置?

upd:答案在这里un4seen.com/forum/?topic=15633.msg110256#msg110256

2 个答案:

答案 0 :(得分:3)

以下解决方案来自http://www.un4seen.com/forum/?topic=15633.msg110256#msg110256

1 mkdir lib, then, copy armeabi to lib, the tree should be lib/armeeabi/libbass.so
2 zip lib directory: $zip -r libbass.zip lib
3 rename: $mv libbass.zip libbass.jar
4 copy libbass.jar to YourProject/Youproject/src/main/libs  ("YourProject/Youproject/src/main/" includes AndroidManifests.xml, res, java, libs)
5 add this line:
     compile fileTree(dir: 'libs', include: '*.jar')
  to your build.gradle---->dependencies

答案 1 :(得分:-1)

在我的情况下,正是Crashlytics之间存在冲突。当我在build.gradle中注释下面的行时,一切顺利。

//    compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
//        transitive = true;
//    }
//    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
//        transitive = true;
//    }