在资源路径中找不到com/sun/jna/android-arm/libjnidispatch.so [英] com/sun/jna/android-arm/libjnidispatch.so not found in resource path

查看:427
本文介绍了在资源路径中找不到com/sun/jna/android-arm/libjnidispatch.so的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下所有操作均在Android Studio中完成.

All of the following is being done in Android Studio.

我已经成功编译并测试了Android Watson Speech to Text演示应用程序.然后,我创建了一个包含Watson相关API的库项目,并创建了一个第二个应用程序项目,该项目具有一个引用了Watson库项目的简单UI. UI成功启动,并向文本api调用Watson语音.我以为我可以真正使用Watson库项目.

I have successfully compiled and tested the Android Watson Speech to Text demo app. I then created a library project containing the Watson related API's and a 2nd app project with a simple UI that references the Watson library project. The UI successfully starts and calls Watson speech to text api's. I thought I was set to use the Watson library project for real.

因此,我将Watson API项目合并到了我的真实"项目中.当我启动与Watson的应用程序连接时,我得到:

So I incorporated the Watson API project into my 'real' project. When I start the app connection to Watson I am getting:

E/AndroidRuntime: FATAL EXCEPTION: initStreamToServerThread
                   Process: com.sixflags.android, PID: 25481
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/android-arm/libjnidispatch.so) not found in resource path (.)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:786)                                                                              
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:746)                                                                            
at com.sun.jna.Native.<clinit>(Native.java:135)                                                                          
at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:82)                                                                          
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:337)                                                                          
at com.ibm.watson.developer_cloud.android.speech_to_text.v1.opus.JNAOpus.<clinit>(JNAOpus.java:42)                                                                         
at com.ibm.watson.developer_cloud.android.speech_to_text.v1.audio.OggOpusEnc.initEncoderWithUploader(OggOpusEnc.java:53)
at com.ibm.watson.developer_cloud.android.speech_to_text.v1.audio.WebSocketUploader.initStreamAudioToServer(WebSocketUploader.java:113)
at com.ibm.watson.developer_cloud.android.speech_to_text.v1.audio.WebSocketUploader.access$000(WebSocketUploader.java:46)
at com.ibm.watson.developer_cloud.android.speech_to_text.v1.audio.WebSocketUploader$2.run(WebSocketUploader.java:175) 

我在libs目录中包含了Speech-android-wrapper.aar,并在gradle.build中包含了依赖关系:

I have included speech-android-wrapper.aar in the libs directory and have included in the gradle.build dependencies:

compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.ibm.watson.developer_cloud:java-sdk:2.10.0'
compile(name: 'speech-android-wrapper', ext: 'aar')

我的应用程序很大,并且正在使用多义处理,所以我想知道这是否可以找出问题所在.

My app is rather large and is using multi-dex'ing so I am wondering if this could a clue to what is going wrong.

在添加后解决的应用程序部分中,我确实遇到了AndroidManifest.xml清单冲突的另一个问题.

I did run into one other issue with a AndroidManifest.xml manifest conflict in the application section that I resolved with adding:

tools:replace="android:icon,android:name"

我看不到这怎么可能导致链接错误,但是只是丢掉了,以防万一我错过了它的重要性.

I don't see how that could cause the link error but just throwing it out there in case I am missing the significance of it.

正在寻找建议.

推荐答案

如果您引用的是"speech-android-wrapper"模块,请在gradle中使用以下配置:

If you're referencing the module of "speech-android-wrapper", please use this configuration in your gradle:

compile project(':speech-android-wrapper')

如果您使用的是AAR库,请尝试以下操作:

If you're using AAR libs, please try this:

dependencies {
  //...
  debugCompile(name:'speech-android-wrapper-debug', ext:'aar')
  releaseCompile(name:'speech-android-wrapper-release', ext:'aar')
}

...

repositories{
  //...
  flatDir{
    dirs 'libs'
  }
}

图标问题已在另一个存储库中得到解决,将很快合并到Watson Developer Cloud存储库中.

Icon issue was resolved already in another repo, will be merged to the Watson Developer Cloud repo soon.

希望有帮助.

这篇关于在资源路径中找不到com/sun/jna/android-arm/libjnidispatch.so的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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