Ошибка при загрузке файла с помощью Retrofit 2

Я пытаюсь загрузить файл (изображение) на сервер, используяRetrofit 2, Я слежу за этимруководство сначала это кажется довольно простым, но в моем случае это не сработало ...

Когда я вызываю функцию API, я всегда получаю эту ошибку:

W/System.err: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
W/System.err:     at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:190)
W/System.err:     at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
W/System.err:     at retrofit2.Retrofit$1.invoke(Retrofit.java:145)
W/System.err:     at java.lang.reflect.Proxy.invoke(Proxy.java:393)
W/System.err:     at com.plante.android.cobalt.fragment.FragmentIncidentPlan.uploadFile(FragmentIncidentPlan.java:575)

Вот мой вызов API:

@Multipart
@POST(Constants.URL_UPLOAD)
Call<ResponseBody> upload(@Part RequestBody description,
                          @Part MultipartBody.Part file);

Вот метод, который я использую для загрузки файла:

private void uploadFile(String path) {
    // create upload service client

    // use the FileUtils to get the actual file by uri
    File file = new File(path);
    Log.e(TAG, file.getAbsolutePath());

    // create RequestBody instance from file
    RequestBody requestFile =
            RequestBody.create(MediaType.parse("multipart/form-data"), file);

    // MultipartBody.Part is used to send also the actual file name
    MultipartBody.Part body =
            MultipartBody.Part.createFormData("picture", file.getName(), requestFile);

    // add another part within the multipart request
    String descriptionString = "hello, this is description speaking";
    RequestBody description =
            RequestBody.create(
                    MediaType.parse("multipart/form-data"), descriptionString);

    // finally, execute the request
    Call<ResponseBody> call = cobaltServices.upload(description, body);
    call.enqueue(new Callback<ResponseBody>() {
        @Override
        public void onResponse(Call<ResponseBody> call,
                               Response<ResponseBody> response) {
            Log.v("Upload", "success");
        }

        @Override
        public void onFailure(Call<ResponseBody> call, Throwable t) {
            Log.e("Upload error:", t.getMessage());
        }
    });
}

Ответы на вопрос(2)

Ваш ответ на вопрос