问题描述
谁能帮我在我的Android项目修复错误。我做Dropbox的与同步在我的项目,但是当我尝试启动应用程序我有错误:java.lang.UnsatisfiedLinkError中:产生的原因库DropboxSync没有找到
Who can help me fix error in my Android Project. I make sync with dropbox in my project, but when i try start app i have errors: Caused by: java.lang.UnsatisfiedLinkError: Library DropboxSync not found
09-02 12:56:55.367 1313-1313/? E/AndroidRuntime: Uncaught handler: thread main exiting due to uncaught exception
09-02 12:56:55.377 1313-1313/? E/AndroidRuntime: java.lang.ExceptionInInitializerError
at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:111)
at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:91)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:132)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:100)
at com.shvedchenko.skleroshop.MainActivity.onCreate(MainActivity.java:44)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at com.dropbox.sync.android.NativeLib.<init>(NativeLib.java:33)
at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:11)
... 18 more
Caused by: java.lang.UnsatisfiedLinkError: Library DropboxSync not found
at java.lang.Runtime.loadLibrary(Runtime.java:489)
at java.lang.System.loadLibrary(System.java:557)
at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:411)
... 20 more
行№44是mDbxAcctMgr = DbxAccountManager.getInstance(getApplicationContext(),APPKEY,appSecret);
Line №44 is mDbxAcctMgr = DbxAccountManager.getInstance(getApplicationContext(), appKey, appSecret);
我不明白什么是错?
THX!
推荐答案
它看起来像这样是本机库和一个gradle这个一般性问题。我发现这个苏答案有所帮助:Include .so库在Android的工作室 APK
It looks like this is a general issue with native libraries and gradle. I found this SO answer helpful: Include .so library in apk in android studio
我的的build.gradle
文件的一部分,现在看起来是这样的,和我的应用程序成功启动:
Part of my build.gradle
file now looks like this, and my app starts successfully:
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: '*.jar')
}
task nativeLibsToJar(
type: Zip,
description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
extension 'jar'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
tasks.withType(Compile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
}
这篇关于Android和放大器; DropboxSync库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!