Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropbox Sync API - Unsatisfied Link Error

I am trying to implement DropboxSync API in my existing Android Application.
I have downloaded the DropboxSync API and copied all the libs in my Application's lib folder.
I have also pointed the Native Library location to the libs folder where libDropboxSync.so is located.

Manifest.xml

....
        <!-- Dropbox Activities -->
    <activity android:name="com.dropbox.sync.android.DbxAuthActivity" />
    <activity
        android:name="com.dropbox.client2.android.AuthActivity"
        android:launchMode="singleTask" >
        <intent-filter>
            <data android:scheme="db-intentionally-hidden-app-key" />

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <service
        android:name="com.dropbox.sync.android.DbxSyncService"
        android:enabled="true"
        android:exported="false"
        android:label="Dropbox Sync" />


Main_Activity.java

public class Activity_Main extends Activity implements OnClickListener,
OnItemClickListener, OnTouchListener {
....
....
....
private DbxAccountManager mDbxAcctMgr;

onCreate(....)
{
//Application giving FATAL EXCEPTION on the line below.
mDbxAcctMgr = DbxAccountManager.getInstance((Activity)Activity_Main.this, DROPBOX_APP_KEY, DROPBOX_APP_SECRET); 
....
}
....
}


Logcat Logs

12-06 10:10:25.362: E/AndroidRuntime(8110): FATAL EXCEPTION: main
12-06 10:10:25.362: E/AndroidRuntime(8110): Process: com.***.***, PID: 8110
12-06 10:10:25.362: E/AndroidRuntime(8110): java.lang.UnsatisfiedLinkError: Couldn't load DropboxSync from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.***.***-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.***.***-1, /vendor/lib, /system/lib]]]: findLibrary returned null
12-06 10:10:25.362: E/AndroidRuntime(8110):     at java.lang.Runtime.loadLibrary(Runtime.java:358)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at java.lang.System.loadLibrary(System.java:526)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:447)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.NativeLib.<init>(NativeLib.java:33)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:11)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:155)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:126)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:149)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:115)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.***.***.activities.Activity_Main.onCreate(Activity_Main.java:459)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.Activity.performCreate(Activity.java:5243)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.ActivityThread.access$700(ActivityThread.java:135)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.os.Handler.dispatchMessage(Handler.java:102)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.os.Looper.loop(Looper.java:137)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at android.app.ActivityThread.main(ActivityThread.java:4998)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at java.lang.reflect.Method.invokeNative(Native Method)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at java.lang.reflect.Method.invoke(Method.java:515)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-06 10:10:25.362: E/AndroidRuntime(8110):     at dalvik.system.NativeStart.main(Native Method)
12-06 10:10:25.532: W/ActivityThread(8110): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());

I have already tried this solution :Error in dropboxSync: findlibrary returned null
But it is not working for me.
So please don't mark this question as a duplicate.

Any Help is highly appreciated, thanks.

like image 523
Salman Khakwani Avatar asked Dec 06 '13 05:12

Salman Khakwani


2 Answers

libDropboxSync.so was missing in armeabi-v7a folder under the libs directory.
I copied libDropboxSync.so from armeabi-v7 folder to armeabi-v7a folder under the libs directory, and the library was loaded successfully.
Since i am using Google-Nexus-7 2nd generation for debugging, therefore the DropboxSync library in armeabi-v7a folder was a must.

like image 125
Salman Khakwani Avatar answered Nov 02 '22 02:11

Salman Khakwani


Check out the 3rd and 4th point. Give 2 minutes of look on those two.

  1. Within Android Studio, switch to the "project view".
  2. From the libs directory in the downloaded SDK, drag dropbox-sync-sdk-android.jar into your project's app/libs directory.
  3. Right-click on dropbox-sync-sdk-android.jar and choose "Add as library". Click "OK" on the dialog that appears.
  4. Make a new directory in your project under app/src/main called jniLibs. From the SDK, drag armeabi, armeabi-v7a, mips, and x86 into the new jniLibs directory.
like image 38
Nabin Avatar answered Nov 02 '22 01:11

Nabin