Android Question DropboxV2 Create Folder error

Turbo3

Active Member
Licensed User
Longtime User
The first time I execute this command
B4X:
dbxFiles.createFolder("/New Folder 1")

I get this error and the application crashes. However the folder is created in my Dropbox.
B4X:
java.lang.Exception: Sub dbxfiles_createfolder signature does not match expected signature.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:188)
    at anywheresoftware.b4a.BA$2.run(BA.java:360)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5343)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Once the folder is created executing that same line of code does not cause the app to crash.

What am I doing wrong? Can someone explain what signature it is referring to.

Also placing a Try/Catch around the line does not catch the error so I could ignore it. Therefore I am not able to stop the app from crashing when I create a new folder.

Here is the dbxFiles_CreateFolder routine if that helps. I am guessing that the parameter list is some how wrong but I think I got it from the example code. Perhaps something obvious I am missing.
B4X:
Sub dbxFiles_CreateFolder(success As Boolean, meta As FolderMetadata, error As String)
    Log("==> dbxFiles_CreateFolder")
'    Log($"dbxFiles_CreateFolder(${success}, ${error})"$)
End Sub
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
try
B4X:
Sub dbxFiles_CreateFolder(success As Boolean, meta As FolderMetadata)
    Log("==> dbxFiles_CreateFolder")
'    Log($"dbxFiles_CreateFolder(${success})"$)
End Sub
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
Same error. (Actually worse, see next post)

But these two work fine. I will test Upload after we get create folder working.

B4X:
Sub dbxFiles_listFolder(success As Boolean, content As List, error As String)
Sub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String)

Upload works too.

B4X:
Sub dbxFiles_UploadFinished(success As Boolean, meta As FileMetadata, error As String)
 
Last edited:
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
Found something new if I use your suggestion.

It always crashes. Even when the folder exists.

With the original code from the example it only crashes when it actually creates a folder. If the folder already exists it does not crash.

It seems the expected number/type of parameters changes based on whether it succeeded or not. If it fails (because it already existed) then the example code is correct.

When it does not crash here is what the Log statement prints when I add success and error parameter. Which looks correct if the folder already exists.
B4X:
==> dbxFiles_CreateFolder false  Exception in 2/files/create_folder: {".tag":"path","path":{".tag":"conflict","conflict":"folder"}}
 
Last edited:
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
Until you can get this problem fixed I am adding back in the old DropboxV2.bas code stripped down to just handle create folder.

This works fine to create a folder without crashing the app. I just needed to add back the OkHttp and OkHttpUtils2 iibraries again to support DropboxV2.bas.
 
Last edited:
Upvote 0
Top