cloudinary / cloudinary_android

Android client for integrating with Cloudinary
MIT License
67 stars 59 forks source link

Invalid Json Response #95

Closed arunk095 closed 2 years ago

arunk095 commented 5 years ago

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]

yakirp commented 5 years ago

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

xghita commented 5 years ago

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.

xghita commented 5 years ago

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

yuval-cloudinary commented 5 years ago

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

AlexW00 commented 4 years ago

Any fix??

michalkcloudinay commented 4 years ago

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

tekinarslan commented 2 years ago

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

adimiz1 commented 2 years ago

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