9

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.

Community
  • 1
  • 1
Salman Khakwani
  • 6,684
  • 7
  • 33
  • 58

3 Answers3

9

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.

Salman Khakwani
  • 6,684
  • 7
  • 33
  • 58
  • 1
    An armeabi-v7a device should fall back to finding the native library in the armeabi directory. However I've started to get reports of inconsistent behavior across OS versions which occurs if you have other native libraries in armeabi-v7a mixed with libDropboxSync.so in armeabi. Copying the file as you discovered should be safe. It goes to the same place after the app is installed, and the inconsistencies are in the installation process. – Andrew Dec 07 '13 at 04:59
  • 1
    Yes, i was thinking the same. Thank God, copying the lib has solved the problem :-) – Salman Khakwani Dec 08 '13 at 06:54
  • My app didn't even *have* `armeabi-v7a` or `armeabi-v7` folders under libs, but creating `armeabi-v7` and copying the SO from `armeabi` seemed to fix the problem – andygeers Jul 16 '14 at 07:31
1

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.
Nabin
  • 11,216
  • 8
  • 63
  • 98
0

found a aolution in some google group compress this to a zip file: lib/armeabi/libDropboxSync.so

** pay attention! it has to be 'lib' and not 'libs' **

now, rename the 'lib.zip' file to 'armeabi.jar' and add it to the 'libs' directory of your module (where the dropbox jar is in) all the other 'solutions' i found online didn't help except this one.

do it for every environment you need such as armeabi-v7 etc.

gutte
  • 1,373
  • 2
  • 19
  • 31