Android Question Dropbox Sync API findLibrary Returned NULL

DaveB4A

Member
Licensed User
Longtime User
Since I don't have any "remote" database capabilities for getting data to/from my "test" application, I thought I'd attempt to use my existing DropBox account as an "external" data source.

In theory, I have followed all of the steps outlined in:


The "plan" was to load "input transaction records" into a file on the DropBox, have them sync'd to and then processed on the phone, then have the processed results copied back to the DropBox folder.

I, admittedly, don't have a good "mental concept" of how the overall process works - so I thought I'd try the basic steps shown in the document above.

When the line of code:

manager.Initialize(key, secret, "manager")

executes... The following JAVA error is thrown:

B4X:
mainafterFirstLayout (java line: 98)
 
 
java.lang.ExceptionInInitializerError
 
 
    at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:155)
    at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:126)
    at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:149)
    at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:115)
    at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.Initialize(DbxAccountManagerWrapper.java:48)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:520)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:235)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at b4a.example.main.afterFirstLayout(main.java:98)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:76)
    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:4745)
    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:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    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)
    ... 25 more
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load DropboxSync: findLibrary returned null
    at java.lang.Runtime.loadLibrary(Runtime.java:365)
    at java.lang.System.loadLibrary(System.java:535)
    at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:447)
    ... 27 more

I'm guessing the specific issue is related to:

Couldn't load DropboxSync: findLibrary returned null

To me, it looks like some component is missing? I have the "DropboxSync (version: 1.20)" checked in my "Referenced Libraries" list.

Can someone point me in the right direction here please. I simply need the app (upon launch) to download one specific file from the DropBox account (process it via a Service) and then upload the "modified" file back to the DropBox account.
 

DaveB4A

Member
Licensed User
Longtime User
No, it is being tested on the Genymotion emulator - as I read a number of Forum posts saying this was a good tool to use for testing. If you think it might be related to that, I can get a device connected to the B4A Bridge and test it on an actual device?

And yes, I understand the limitation of DropBox working "only for me" - which is fine, at this point. I actually purchased the B4A product to help a number of educator friends develop some simple apps for use in their classrooms. In most of those cases, they will want some kind of "centralized" server / sync capability - but for now I'm simply trying to simulate some kind of "external" input to process via a Service - and DropBox seemed to be a "potentially easy" solution. :)

Ultimately, I'd like to try to connect to some type of database (perhaps with the Remote Database Connector) - possibly to a file on their classroom computer (RDC without a database server) - but I'm just beginning to learn about B4A so I'm trying to not get too many irons in the fire while I'm trying to master the basics.
 
Upvote 0

DaveB4A

Member
Licensed User
Longtime User
First, THANK YOU for all of your help. I appreciate it. I did try using B4A Bridge - and I'll post the result below. But, can you please explain why using the B4A bridge is "recommended"? I originally had issues using B4A Bridge (and Debug Legacy vs. Debug Rapid) and switching to the Genymotion emulator "fixed" those issues - meaning the results work consistently in either Debug mode? Just trying to learn about the architecture...

When I tried the application using the B4A Bridge to a Samsung device - it did not generate the JAVA error. (Again, not sure WHY that is the case but the error did not appear?) However, on the Samsung device, I'm having the same "issue" noted in the post:


The "initialize" now fires - and works (I got the "one time prompt" from DropBox and authorized access) but now - as noted in the link above - the
Manager_AccountReady SUB never fires. There is no error message. The application simply sits at the main screen.

I am currently trying to understand why or how I might need to employ "Manager.UnlinkAccount" to resolve the issue - although it's not clear from the post why this is "sometimes needed" (???). I'm still trying to find where the reference is for the "Unfiltered Logs" location that describes what's happening with the DropBox app.
 
Upvote 0

DaveB4A

Member
Licensed User
Longtime User
An additional question... When I set up the DropBox SYNC API I set it up for "FULL ACCESS" to all files in my DropBox account. I did this for no particular reason, except that I wasn't sure where I might put files... Now that I'm researching the latest "problem" with "AccountReady" not firing... I noticed that the DropBox API only supports the "full access DropBox permission" when using their CORE API. (There is also a 2nd API called SYNC - which apparently does NOT work with FULL access.)

Can you please tell me which one of these API's B4A is using to access DropBox?
 
Upvote 0

DaveB4A

Member
Licensed User
Longtime User
Those are the steps that have been followed... I copied that code and manifest lines - inserting my DropBox values where noted. I'm still not understanding what part of the earlier JAVA error that some library wasn't supported by Genymotion? But, as noted, when using the B4A bridge - the code (as posted in the thread you mentioned) runs fine - but AccountReady never fires. I think I may have posted additional information before you replied. I think there may be an issue with the API (CORE vs. SYNC) but I'm waiting on a developer to respond to me on how to confirm if that is in fact the issue.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Dave .. if it is of any use to you .. by any chance have you used the generated app key / secret key with a second app by any chance.

I have just followed setup a test app following the steps mentioned in Erels link .. All went well ( Real device via USB).
I then proceeded to apply keys / manifest edit etc to another app , with complete failure.
The Sub AccountReady would not fire at all .. (I would have thought at least a Success = False)

I completely deleted my app from Dropbox and started again .. applyling the new keys to my b4a app and all is good.

Just a thought
Cheers mj
 
Upvote 0

DaveB4A

Member
Licensed User
Longtime User
MangoJack - thanks for the reply. I'm brand new at B4A so I only have one app so far :) - and it's the only one I've tried to use with DropBox.

Out of curiosity, when you submitted the necessary info to DropBox to generate your "keys" - what "choices" did you select?

It appears, if you select the options as I did:
  • Files and Datastores
  • No - My app needs access to files already on DropBox
  • All Files Types - My app needs access to a user's full DropBox
This requires access via the DropBox CORE API ONLY. Apparently (per their developers) they have TWO API's (CORE and SYNC) and if you attempt to access things using keys based the choices I selected - you can only do so if you use the CORE API.

In a previous reply back to Erel, I asked him to please confirm which one of the API's B4A was using. He has not replied yet. But, if B4A happens to use the SYNC API - then I will not be able to access the files based on my current key configuration - and I'll need to rethink the access required and re-generate keys for either PRIVATE FOLDER or FILE TYPE access only.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Dave .. the only options I chose were ..
  • Files and Data stores
  • Yes - My App only needs access to the files it creates
still on trainer wheels myself here ... my app just stores data in db which is then uploaded (more for safe keeping than anything else at the moment)

I dont need access to all my other dropbox files.

Playing / learning RDC presently to eventually edit the db remotely.

This seemed something relatively easy to do .. which it was

Cheers mj
 
Upvote 0

DaveB4A

Member
Licensed User
Longtime User
Sorry, Erel, I must have missed that. Given that fact, I have confirmed that we will not be able to use the B4A Library to perform the application functions as designed. In the mean time, I will get some developers to look into what it would take to wrap the CORE functionality. In the interim, DropBox has regenerated a "limited" set of keys which we will use with the existing library. THANKS, again, for the info.
 
Upvote 0
Top