cloudinary/cloudinary_android

Invalid Json Response

arunk095 opened this issue · 8 comments

Im getting invalid JSON while uploading a file
Exception:Invalid JSON response from server A JSONObject text must begin with '{' at 1 [character 2 line 1]

Hi!
Could you please share more information like the code you're using, and maybe the file you're trying to upload?

I'm looking forward to your response.

Thanks

Hi!

I am having the same issue, for an unsigned upload with android sdk.

This is the code for upload picture
` MediaManager.init(this);

    val requestId = MediaManager.get().upload(uri).unsigned("square_image").callback(object : UploadCallback {
        override fun onStart(requestId: String) {
            // your code here
        }

        override fun onProgress(requestId: String, bytes: Long, totalBytes: Long) {
            // example code starts here
            val progress = bytes.toDouble() / totalBytes
            // post progress to app UI (e.g. progress bar, notification)
            // example code ends here
        }

        override fun onSuccess(requestId: String, resultData: Map<*, *>) {
            // your code here
        }

        override fun onError(requestId: String, error: ErrorInfo) {
            // your code here
        }

        override fun onReschedule(requestId: String, error: ErrorInfo) {
            // your code here
        }
    }).dispatch()

`

and this is the uri value file:///storage/emulated/0/Android/data/com.cofedistrict.staging/cache/replace_with_user__id.jpg

I can see the picture on my android device.

I am facing this even with sample application, with my cloudinary url

Please share your cloud name, so we can track this down.
Thanks!

Any fix??

Hi @AlexW00, In order to assist with your issue please open a support ticket with your cloud name at support@cloudinary.com. Thanks!

@ArunAmmu did you check your CLOUDINARY_URL. from meta data in manifest.
I met same error and solve with meta data init.

We managed to reproduce the issue, this occurs because of bad cloud_name passed to the upload request, please make sure you pass the right cloud_name to the upload request.
You can verify you passed the right arguments by printing the config and confirming the values are right.
Closing the issue.
If you still have a problem please feel free to open another issue or contact our support: support@cloudinary.com