我正在尝试创建一个Android应用程序,它同时使用Android的CNU Project Sphinx库和Android的Spotify库。我可以在单独的项目中实现库,但是当我尝试将它们组合成一个时,我得到错误:
14178-14178/com.tmacstudios.spotifyvoice E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tmacstudios.spotifyvoice, PID: 14178
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.tmacstudios.spotifyvoice-2/base.apk"],nativeLibraryDirectories=[/data/app/com.tmacstudios.spotifyvoice-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libgnustl_shared.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:988)
at com.spotify.sdk.android.player.NativeSdkPlayer.nativeInit(NativeSdkPlayer.java:44)
at com.spotify.sdk.android.player.NativeSdkPlayer.<clinit>(NativeSdkPlayer.java:34)
at com.spotify.sdk.android.player.Player.<init>(Player.java:310)
at com.spotify.sdk.android.player.Player.create(Player.java:356)
at com.spotify.sdk.android.player.Player.access$000(Player.java:86)
at com.spotify.sdk.android.player.Player$Builder.build(Player.java:282)
at com.spotify.sdk.android.player.Spotify.getPlayer(Spotify.java:110)
at com.spotify.sdk.android.player.Spotify.getPlayer(Spotify.java:76)
at edu.cmu.pocketsphinx.demo.PocketSphinxActivity.onActivityResult(PocketSphinxActivity.java:272)
at android.app.Activity.dispatchActivityResult(Activity.java:6758)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4726)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4773)
at android.app.ActivityThread.access$1500(ActivityThread.java:205)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6895)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
有谁知道如何解决这个问题?我不确定还包括什么,所以这是我的Module:app -
的build.gradle文件apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.tmacstudios.spotifyvoice"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
// This library handles authentication and authorization
compile 'com.spotify.sdk:spotify-auth:1.0.0-beta12@aar'
// This library handles music playback
compile 'com.spotify.sdk:spotify-player:1.0.0-beta12@aar'
// All other dependencies for your app should also be here:
compile 'com.android.support:appcompat-v7:21.0.3'
}
感谢您的帮助。
答案 0 :(得分:1)
为了更清楚地显示我的问题的答案,这里是注释线程中解决我问题的信息:
My guess is that they both have NDK libraries, but they have a varying set of CPU architectures that they support. Particularly for devices with 64-bit CPUs, Android wants to use a consistent set of libraries: all 64-bit or all 32-bit. So, if one library publishes 64-bit and another publishes only 32-bit, somebody loses, and IIRC it's the 32-bit-only publisher. Examine the contents of each library and see what CPU architectures seem to be supported. Come up with a common subset.
-CommonsWare
You were spot on. Spotify only defines jni libraries for armeabi, armeabi-v7a, and x86, so I deleted the extraneous architecture libraries that were supported by Sphinx and it worked.
-Me
答案 1 :(得分:0)