2

I am using Retrofit 2.5.0 to upload images to a NodeJS Server, When I try to upload images it gives me an error. when I logged the request it doesn't read the full file and gives EOF exception.
I am using MultiPart to upload and this is my code snippet

RequestBody requestFile =
                RequestBody.create(MediaType.parse("image/jpg"), file);
        MultipartBody.Part body =
                MultipartBody.Part.createFormData("image", file.getName(), requestFile);

// add another part within the multipart request

RequestBody fullName =
                RequestBody.create(
                        MediaType.parse("multipart/form-data"), image.getDescription());

This is the okHttp log:

 --------- beginning of main
10-30 14:25:45.330 11236-11402/com.project.peoject D/OkHttp: �Dw�m�1��l��n�D�RXZX�1[)$M��l�`���7Q���n�ӟ̊e��L�،����=�k����*a�~�g��=�U�ɨ@<�x���/���>� ���R���@���z�;c�?��Zʖ7��ۮ�0��*r�����#ך������3��J��F{���v�   ����Kk�̌�$|�|                                                               
read: unexpected EOF!
Masoud Rahimi
  • 5,785
  • 15
  • 39
  • 67
  • Can you share your retrofit interface method ? – iCantC May 14 '19 at 07:58
  • Possible duplicate of [Logcat crashes with error: unexpected EOF](https://stackoverflow.com/questions/48689930/logcat-crashes-with-error-unexpected-eof) – John Joe May 14 '19 at 08:27

1 Answers1

2

"read: unexpected EOF!" is Logcat error when facing with large amount of logs. you can enlarge your buffer size by running this line:

adb logcat -G 1m

default size of buffer is 256k and by running above line, you will increase it to 1MB.

kAvEh
  • 534
  • 4
  • 15