小编Waq*_*qas的帖子

获取意外的JDWP错误:103尝试使用改造上传图像到api服务器android?

尝试使用改装多部件在api服务器上传图像时,我收到以下103错误消息,api收到api令牌,"_ method":"PUT"和图像url作为参数,响应时收到完整的JSON但是使用上一个或默认图像链接,当前所选图像不上传,其他一切都是可选的,任何帮助将不胜感激,代码列在下面谢谢.

主要的方法是POST,但"_method":"PUT"参数允许你上传图像,没有_method它变成一个POST消息和所有其他参数而不是强制,请检查图像.

com.sun.jdi.InternalException:意外的JDWP错误:103

接口:

public interface UserSignUpClient {

@POST("account")
Call<AuthenticationAccountCreationResponse> createAccount(@Body UserSignUp userSignUp);

@Multipart
@PUT("account")
Call<UserInfo> postImage(@Header("Authorization") String headerValue, @PartMap Map<String, String> map, @PartMap Map<String, File> imageMap, @Part MultipartBody.Part image);

@FormUrlEncoded
@POST("account")
Call<UserInfo> updateUser(@Header("Authorization") String headerValue, @FieldMap Map<String, String> map);
}
Run Code Online (Sandbox Code Playgroud)

改造生成器类:

public class RestClient {

private UserSignInClient userSignInClient;
private UserSignUpClient userSignUpClient;
private UserInfoClient userInfoClient;

public RestClient(String baseUrlLink){

    Gson gson = new GsonBuilder()
            .setLenient()
            .create();

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(baseUrlLink)
            .addConverterFactory(GsonConverterFactory.create(gson)).build();

    if (baseUrlLink.equals(CONSTS.BASE_URL_ADDRESS_TOKEN)){

        userSignInClient = retrofit.create(UserSignInClient.class);
    } else …
Run Code Online (Sandbox Code Playgroud)

java android android-studio retrofit retrofit2

9
推荐指数
1
解决办法
5715
查看次数

标签 统计

android ×1

android-studio ×1

java ×1

retrofit ×1

retrofit2 ×1