Java 与通过android studio安装相比,作为APK安装时,改型行为不同&无法解析

Java 与通过android studio安装相比,作为APK安装时,改型行为不同&无法解析,java,android,retrofit2,Java,Android,Retrofit2,我有一个简单的网络呼叫,它使用Jackson作为转换器,设置如下 Retrofit retrofit = new Retrofit.Builder() .baseUrl("*****") .addConverterFactory(JacksonConverterFactory.create(new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL)))

我有一个简单的网络呼叫,它使用Jackson作为转换器,设置如下

Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("*****")
            .addConverterFactory(JacksonConverterFactory.create(new 

ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL)))
            .build();

apiService = retrofit.create(APIService.class);

使用获取BGControl对象的列表

public interface APIService {

@GET("endpoint/{ID}")
Call<List<BGControl>> getBGControlData(@Path("ID") int patientId, @Query("start") String startDate, @Query("end") String endDate);
}
}

以下是网络呼叫消费者代码

final Call<List<BGControl>> graphDataCall = NetworkManager.getInstance().getAPIService().getBGControlData(13614, startDate, endDate);


   graphDataCall.enqueue(new Callback<List<BGControl>>() {

        @Override
        public void onResponse(Call<List<BGControl>> call, Response<List<BGControl>> response) {

            List<BGControl> bgControlList = response.body();
            if (bgControlList.size() > 0) {
             }

        }

        @Override
        public void onFailure(Call<List<BGControl>> call, Throwable t) 
       {
            graphDataCall.cancel();
        }
    });
然而,问题是,当我通过Android studio运行它时,它会在设备中安装APK,并且我检查它,我会正确地映射响应,从而更新我已经呈现了多个图形的UI!有了这样的回应!studio运行assembleProdDebug命令。但是当我在设备adb安装-r***.apk中使用命令行安装相同的apk时,响应为空

这很奇怪,我将此apk发送给客户端:在手动安装和验证此apk之前,现在这是一个问题


如果您遇到类似问题,请提出解决方案

您可能使用了proguard来缩小更改变量名称的代码

在生成apk时,可以尝试从build.gradle文件中将minifyEnabled设置为false

如果要在改装时使用proguard,请检查此问题的答案:

final Call<List<BGControl>> graphDataCall = NetworkManager.getInstance().getAPIService().getBGControlData(13614, startDate, endDate);


   graphDataCall.enqueue(new Callback<List<BGControl>>() {

        @Override
        public void onResponse(Call<List<BGControl>> call, Response<List<BGControl>> response) {

            List<BGControl> bgControlList = response.body();
            if (bgControlList.size() > 0) {
             }

        }

        @Override
        public void onFailure(Call<List<BGControl>> call, Throwable t) 
       {
            graphDataCall.cancel();
        }
    });