1、确认更新到Retrofit2.0的beta2版本(以下内容均以beta2版本为基准)
2、Post参数均为RequestBody,在使用的时候传入参数进行如下处理:
RequestBody.create(MediaType.parse("image/*"), new File(uri.getPath()))
RequestBody.create(MediaType.parse("text/plain"), string)
3、在file对应的@part()里面将文件路径写进去。
@Part("file\"; filename=\"image.jpg") RequestBody file;
注:image.jpg为文件名字,需要与file对应文件名字一致
Retrofit2.0beta版本Multipart参数导致的文件post上传失败解决方法
原文:http://www.cnblogs.com/xwysun/p/5043773.html