Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Kevin H.27's avatar
Kevin H.27
New member | Level 1
10 years ago

BadResponseException: Bad JSON

Dear Dropbox Community,

I am using the Dropbox API v2 for my Android app. Lately I have been seeing issues when trying to download a file with client.files().download() where the file does not (yet) exist. Instead of the expected DownloadErrorException, I am getting a BadResponseException (full stack below). I am using the SDK as in compile 'com.dropbox.core:dropbox-core-sdk:2.0.2'

Any ideas?

com.dropbox.core.BadResponseException: Bad JSON: No suitable constructor found for type [simple type, class com.dropbox.core.DbxRequestUtil$ErrorWrapper$ApiErrorResponse<com.dropbox.core.v2.files.DownloadError>]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
at [Source: buffer(com.android.okhttp.internal.http.HttpConnection$ChunkedSource@87dfad0).inputStream(); line: 1, column: 2]
at com.dropbox.core.v2.DbxRawClientV2$2.execute(DbxRawClientV2.java:157)
at com.dropbox.core.v2.DbxRawClientV2$2.execute(DbxRawClientV2.java:129)
at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:238)
at com.dropbox.core.v2.DbxRawClientV2.downloadStyle(DbxRawClientV2.java:129)
at com.dropbox.core.v2.files.DbxUserFilesRequests.download(DbxUserFilesRequests.java:258)
at com.dropbox.core.v2.files.DbxUserFilesRequests.download(DbxUserFilesRequests.java:284)
at com.podcatcher.deluxe.model.sync.dropbox.DropboxPodcastListSyncController$DropboxSyncPodcastListTask.getServerSubscriptions(DropboxPodcastListSyncController.java:187)
at com.podcatcher.deluxe.model.sync.dropbox.DropboxPodcastListSyncController$DropboxSyncPodcastListTask.doInBackground(DropboxPodcastListSyncController.java:104)
at com.podcatcher.deluxe.model.sync.dropbox.DropboxPodcastListSyncController$DropboxSyncPodcastListTask.doInBackground(DropboxPodcastListSyncController.java:88)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class com.dropbox.core.DbxRequestUtil$ErrorWrapper$ApiErrorResponse<com.dropbox.core.v2.files.DownloadError>]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
at [Source: buffer(com.android.okhttp.internal.http.HttpConnection$ChunkedSource@87dfad0).inputStream(); line: 1, column: 2]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1130)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:298)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:133)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2863)
at com.dropbox.core.DbxRequestUtil$ErrorWrapper.fromResponse(DbxRequestUtil.java:273)
at com.dropbox.core.v2.DbxRawClientV2$2.execute(DbxRawClientV2.java:152)
... 13 more

 

11 Replies

Replies have been turned off for this discussion

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!