Dropbox Sync Library

gadgetmonster

Active Member
Licensed User
Longtime User
I have tried to build your example and believe I have everything in the correct place, however, I receive the following error in the Initialize line:

B4X:
Installing file.
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 28)
mgr.Initialize(key, secret, "manager")
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 anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.Initialize(DbxAccountManagerWrapper.java:48)
   at b4a.example.main._activity_create(main.java:248)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
   at b4a.example.main.afterFirstLayout(main.java:89)
   at b4a.example.main.access$100(main.java:16)
   at b4a.example.main$WaitForLayout.run(main.java:74)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4898)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
   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)
   ... 21 more
Caused by: java.lang.NoSuchMethodError: no method with name='<init>' signature='(Lcom/dropbox/sync/android/NativeApp;)V' in class Lcom/dropbox/sync/android/NativeHttp;
   at com.dropbox.sync.android.NativeHttp.nativeClassInit(Native Method)
   at com.dropbox.sync.android.NativeHttp.nativeClassInit(Native Method)
   at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:412)
   ... 23 more

Any ideas?
 

dealsmonkey

Active Member
Licensed User
Longtime User

Have you done this stage ??

1. Download the Android SDK: https://www.dropbox.com/developers/sync
Unzip it and copy dropbox-sync-sdk-android.jar to the libraries folder.
 

tkristensen

Member
Licensed User
Longtime User
Erel,

I'm having the same issue gadgetmonster had above...from my log:
B4X:
main_activity_create (B4A line: 29)
manager.Initialize(key, secret, "manager")
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 anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.Initialize(DbxAccountManagerWrapper.java:48)
   at b4a.example.main._activity_create(main.java:251)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
   at b4a.example.main.afterFirstLayout(main.java:89)
   at b4a.example.main.access$100(main.java:16)
   at b4a.example.main$WaitForLayout.run(main.java:74)
   at android.os.Handler.handleCallback(Handler.java:605)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4424)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
   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)
   ... 21 more
Caused by: java.lang.NoSuchMethodError: no method with name='<init>' signature='(Lcom/dropbox/sync/android/NativeApp;)V' in class Lcom/dropbox/sync/android/NativeHttp;
   at com.dropbox.sync.android.NativeHttp.nativeClassInit(Native Method)
   at com.dropbox.sync.android.NativeHttp.nativeClassInit(Native Method)
   at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:412)
   ... 23 more
** Activity (main) Resume **

I tried the library you linked with the mips and x86 libs included, but that didn't seem to make a difference. I did notice that that sdk lib was updated on Jul 24th, but the changelog didn't look like there was much changed so do we need an updated b4a wrapper for it?

Any help appreciated

Tom
 

rboeck

Well-Known Member
Licensed User
Longtime User
Sorry, i only changed the library and the app does start and ends without viewing anything; here the log file:

B4X:
adressliste_activity_create (B4A line: 178)
manager.Initialize(dpAppKey, dpAppSecret, "manager")
java.lang.ExceptionInInitializerError
    at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:109)
    at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:89)
    at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:112)
    at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:99)
    at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.Initialize(DbxAccountManagerWrapper.java:48)
    at at.rb.b4a.gmap1.adressliste._activity_create(adressliste.java:712)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at at.rb.b4a.gmap1.adressliste.afterFirstLayout(adressliste.java:89)
    at at.rb.b4a.gmap1.adressliste.access$100(adressliste.java:16)
    at at.rb.b4a.gmap1.adressliste$WaitForLayout.run(adressliste.java:74)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:213)
    at android.app.ActivityThread.main(ActivityThread.java:4788)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
    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)
    ... 21 more
Caused by: java.lang.NoSuchMethodError: no method with name='<init>' signature='(Lcom/dropbox/sync/android/NativeEnv;)V' in class Lcom/dropbox/sync/android/NativeHttp;
    at com.dropbox.sync.android.NativeHttp.nativeClassInit(Native Method)
    at com.dropbox.sync.android.NativeHttp.nativeClassInit(Native Method)
    at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:365)
    ... 23 more
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **

Reinhard
 

rboeck

Well-Known Member
Licensed User
Longtime User
Yes, it is 1.10; i had no problem with 1.0; but i can go back, i have a backup of the previous files.
 

rboeck

Well-Known Member
Licensed User
Longtime User
I changed the Dropbox Sync API; now i it sometimes works, sometime the app stops few seconds after starting. The log file:

B4X:
java.lang.RuntimeException: Unable to start service com.dropbox.sync.android.DbxSyncService@420e2c38 with Intent { cmp=at.rb.b4a.gmap1/com.dropbox.sync.android.DbxSyncService (has extras) }: java.lang.RuntimeException: Invalid start count -1 after handleStartCommand(-1).
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2528)
    at android.app.ActivityThread.access$1900(ActivityThread.java:138)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:213)
    at android.app.ActivityThread.main(ActivityThread.java:4788)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Invalid start count -1 after handleStartCommand(-1).
    at com.dropbox.sync.android.DbxSyncService.handleStartCommand(DbxSyncService.java:235)
    at com.dropbox.sync.android.DbxSyncService.onStartCommand(DbxSyncService.java:219)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2511)
    ... 10 more

It tried, to use manager.UnlinkAccount in Activity_Pause; but i didnt change anything.
 

rboeck

Well-Known Member
Licensed User
Longtime User
Can you reproduce it with code similar to the code in the first post?

I tried, but i it worked without problems. Then i went back to my app and for now the app starts, but later, when i make an backup to dropbox with following code:
B4X:
manager.uploadfile(Datadir, "mobilcrm.db","/","mobilcrm.db")
i get java.lang.NullpointerException. The string with datadir is filled, i dont know, why this code doesnt work anymore?
 

tkristensen

Member
Licensed User
Longtime User
The app is able to start now with the version 1.10 of the library, however I'm still having some issues:

Made a test app based on the sample code in post 1.
Manager.linkaccount brings up the browser asking if I want to provide access. I say Allow on that screen. I never get a hit on the manager_AccountReady event.

If I run the app again the manager.linkaccount does nothing.

I can use the manager.unlinkaccount and run the app again and the linkaccount works as it did the first time.

Upload, download and list all give nul pointer exceptions.

Not sure what to do next

Tom
 

GMan

Well-Known Member
Licensed User
Longtime User


Hoi,
i am using it as following and have no probs at all:
B4X:
manager.UploadFile (SDcardPath & "SourceDir","File.zip","TargetDir","FileBU.zip")
Have you tried a badkslash instaed a slash ?
Have you tried to write the file in a dropbox-directory (AFAIK you have to create it first in DropBox)

The SDcardPath variable is filled with the real sdcard-path for the extern (or 2nd) SD-Card.
This will be computed automatically with a little sub.
 

rboeck

Well-Known Member
Licensed User
Longtime User
Today i switched back to 1.0 and then again to 1.1; i think dropbox doesnt respond for this app anymore. I tried now a second app and made an new app at dropbox; i get more response - my app stops now at my try to upload a file fpr backup etc.:

B4X:
    SQL.Close
    DoEvents
   
    File.Copy(Main.DatenDir, "mobilCrm.db",Main.DatenDir, "mobilCrm.sav")  'making an Backup file with extension sav
   
    DoEvents
   
    SQL.Initialize(Main.DatenDir, "MobilCRM.db", False)  'reopen SQL file
   
    ProgressDialogShow ("Backup  of database to dropbox..")
   
    Log(Main.DatenDir) 
    Log(File.Exists(Main.DatenDir, "mobilCrm.sav"))     'here i see, that the file and path exists... 
   
    manager.UploadFile(Main.DatenDir, "mobilCrm.sav", "/", "mobilCrm.db")   'here i get: java.lang.NullpointerException 
   
    DoEvents
   
    ProgressDialogHide

Everything is here, the code was working more than a week; the file size is 5 MB...
any ideas, what's wrong?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…