android 使用讯飞人脸识别api报错:java.lang.UnsatisfiedLinkError

1、在做一个人脸识别的项目,使用的是讯飞的api,编辑器为AS2.0,运行时报如下错误:

FATAL EXCEPTION: main
                  Process: com.admin.smartcam, PID: 13821
                  java.lang.UnsatisfiedLinkError: Native method not found: com.faceplusplus.api.Native.setMinFaceSize:(II)I
                      at com.faceplusplus.api.Native.setMinFaceSize(Native Method)
                      at com.faceplusplus.api.FaceDetecter.setMinFaceSize(FaceDetecter.java:124)
                      at com.admin.smartcam.detectionface.DetectionFace.<init>(DetectionFace.java:21)
                      at com.admin.smartcam.androidcamera.camera.BitmapCallback.PictureCallbackToBitmap.onPictureTaken(PictureCallbackToBitmap.java:26)
                      at android.hardware.Camera$EventHandler.handleMessage(Camera.java:940)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:136)
                      at android.app.ActivityThread.main(ActivityThread.java:5111)
                      at java.lang.reflect.Method.invokeNative(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:515)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
                      at dalvik.system.NativeStart.main(Native Method)

2、分析【可能是因为系统找不到我的.so文件】

工程目录如下:

android 使用讯飞人脸识别api报错:java.lang.UnsatisfiedLinkError

3、解决办法:

打开build.gradle文件添加如下代码:

    sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}

android 使用讯飞人脸识别api报错:java.lang.UnsatisfiedLinkError

至此就ok了!

上一篇:Eclipse 导入项目后启动报异常:java.lang.UnsatisfiedLinkError: Native Library *.dll already loaded in another classloade 解决方法


下一篇:新手如何用阿里云ECS服务器搭建一个WordPress博客?