如何在外部添加.so文件

时间:2018-01-25 11:01:07

标签: java android android-ndk ndk-build .so

java.lang.UnsatisfiedLinkError:
dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.c.phototopencilsketcheditor-ObszC6NtyRqQ_yniuaI2SA==/base.apk", 
zip file "/data/app/com.example.c.phototopencilsketcheditor-ObszC6NtyRqQ_yniuaI2SA==/split_lib_dependencies_apk.apk",
zip file "/data/app/com.example.c.phototopencilsketcheditor-ObszC6NtyRqQ_yniuaI2SA==/split_lib_slice_0_apk.apk", 
zip file "/data/app/com.example.c.phototopencilsketcheditor-ObszC6NtyRqQ_yniuaI2SA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.c.phototopencilsketcheditor-ObszC6NtyRqQ_yniuaI2SA==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "liblibAndroidImageFilter.so.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at cn.Ragnarok.LightFilter.<clinit>(LightFilter.java:8)
at cn.Ragnarok.LightFilter.changeToLight(Unknown Source:0)
at cn.Ragnarok.BitmapFilter.changeStyle(BitmapFilter.java:75)
at com.example.c.phototopencilsketcheditor.activities.FilterFrameActivity.generarListaEffectosFree(FilterFrameActivity.java:533)
at com.example.c.phototopencilsketcheditor.activities.FilterFrameActivity.onCreate(FilterFrameActivity.java:226)
at android.app.Activity.performCreate(Activity.java:6998)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1230)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2899)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

1 个答案:

答案 0 :(得分:1)

在android Studio项目的main中创建jniLibs文件夹,并将所有.so文件放入其中。您还可以在build.gradle中集成此行。

文件夹结构类似

| --app:

| - | --src:

| - | - | --main

| - | - | - | --jniLibs

| - | - | - | - | --armeabi

| - | - | - | - | - | - 。so Files

| - | - | - | - | --x86

| - | - | - | - | - | - 。so Files