我在为android创建应用程序时收到一条奇怪的logcat消息,我正在调用一个webservice并在这个过程中创建一个listview。我现在用的是 Retrofit 2 。
public ArrayList<AgencyModel> DownloadAgencyData() {
RestApi.getUnicsAgencyApi().getStreams().enqueue(new Callback<ArrayList<AgencyModel>>() {
@Override
public void onFailure(Call<ArrayList<AgencyModel>> arg0, Throwable arg1) {
// TODO Auto-generated method stub
Log.e("Error in parsing", arg0.toString());
}
@Override
public void onResponse(Call<ArrayList<AgencyModel>> AgencyModelData,
Response<ArrayList<AgencyModel>> response) {
// TODO Auto-generated method stub
mstreamData = new ArrayList<AgencyModel>();
// ADD TO List here!!!!!!!!
// Log.e("Response", "" + response.body().size());
if(response.isSuccessful()){
mstreamData.addAll(response.body());
}
}
});
return mstreamData;
}
生成器类如下所示:
public class RestApi {
private static String ENDPOINT_URL = "http://192.168.1.102/UnicsApplication/";
private static UnicsAgencyApi sUnicsAgencyApi;
private static Retrofit retrofit;
public static UnicsAgencyApi getUnicsAgencyApi() {
if (sUnicsAgencyApi == null) {
retrofit = new Retrofit.Builder().baseUrl(ENDPOINT_URL).addConverterFactory(GsonConverterFactory.create())
.build();
sUnicsAgencyApi = retrofit.create(UnicsAgencyApi.class);
}
return sUnicsAgencyApi;
}
public interface UnicsAgencyApi {
//@GET("api/uconnectservice/AllAgency")
@GET("api/uconnectservice")
Call<ArrayList<AgencyModel>> getStreams();
}
}
它得到的完整logcat消息如下:
01-03 16:55:54.592: W/ResourceType(2794): CREATING STRING CACHE OF 36 bytes
01-03 16:55:54.912: I/ActivityManager(2794): Timeline: Activity_idle id: android.os.BinderProxy@41a364b0 time:190796801
01-03 16:56:06.152: D/LIST STATUS(2794): AgencyList is null
01-03 16:56:06.182: W/dalvikvm(2794): VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
01-03 16:56:06.182: W/dalvikvm(2794): VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
01-03 16:56:06.182: I/dalvikvm(2794): Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
01-03 16:56:06.182: W/dalvikvm(2794): VFY: unable to resolve static method 3073: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
01-03 16:56:06.182: D/dalvikvm(2794): VFY: replacing opcode 0x71 at 0x000a
01-03 16:56:06.192: W/dalvikvm(2794): VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
01-03 16:56:06.192: W/dalvikvm(2794): VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
01-03 16:56:06.192: I/dalvikvm(2794): Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
01-03 16:56:06.192: W/dalvikvm(2794): VFY: unable to resolve static method 3072: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
01-03 16:56:06.192: D/dalvikvm(2794): VFY: replacing opcode 0x71 at 0x000a
01-03 16:56:16.192: E/Error in parsing(2794): retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall@41bdff80
我希望任何人都能指导或解释为什么会这样。为了清楚起见,这里是我的java模型
package com.nickSoft.Models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class AgencyModel {
@SerializedName("AgencyName")
@Expose
private String agencyName;
@SerializedName("AgencyLocation")
@Expose
private String agencyLocation;
@SerializedName("AgencyPhoneNumber")
@Expose
private String agencyPhoneNumber;
@SerializedName("AgencyGPSCoordinates")
@Expose
private String agencyGPSCoordinates;
@SerializedName("AgencyHours")
@Expose
private String agencyHours;
public String getAgencyName() {
return agencyName;
}
public void setAgencyName(String agencyName) {
this.agencyName = agencyName;
}
public String getAgencyLocation() {
return agencyLocation;
}
public void setAgencyLocation(String agencyLocation) {
this.agencyLocation = agencyLocation;
}
public String getAgencyPhoneNumber() {
return agencyPhoneNumber;
}
public void setAgencyPhoneNumber(String agencyPhoneNumber) {
this.agencyPhoneNumber = agencyPhoneNumber;
}
public String getAgencyGPSCoordinates() {
return agencyGPSCoordinates;
}
public void setAgencyGPSCoordinates(String agencyGPSCoordinates) {
this.agencyGPSCoordinates = agencyGPSCoordinates;
}
public String getAgencyHours() {
return agencyHours;
}
public void setAgencyHours(String agencyHours) {
this.agencyHours = agencyHours;
}
}
下面是来自webservice的json:
[{"AgencyName":"Head-Office/Branch","AgencyLocation":"Immeuble Grand Carrefour Rue Marie Gocker,Yaounde","AgencyPhoneNumber":"+237222229610/691698762","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Yaounde-Marche-Centrale Branch","AgencyLocation":"Immeuble Grand Carrefour Rue Marie Gocker,Yaounde","AgencyPhoneNumber":"+237222041661/22229604/91697426","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Bamenda Branch","AgencyLocation":"Evidence Building, City Chemist Roundabout,Bamenda","AgencyPhoneNumber":"+237222041665/233364170/691697553","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Deido Branch","AgencyLocation":"Face Boulangerie COAF, Douala","AgencyPhoneNumber":"+237222041660/633402641/691697494","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Bafut Branch","AgencyLocation":"Midland Centre, 3 Corners Njinteh, Bafut","AgencyPhoneNumber":"+237675025263/691698716","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Buea Branch","AgencyLocation":"University Junction, Molyko, Buea","AgencyPhoneNumber":" +237222041664/333323322/691698625","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Bonaberi Branch","AgencyLocation":"Cimetière, Immeuble Pharmacie Bonaberi, Douala","AgencyPhoneNumber":"+237222041663/333392710/691697617","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Biyem-Assi Branch","AgencyLocation":"Carrefour Biyem-assi ,Yaounde","AgencyPhoneNumber":"+237222041662/222316710/691698667","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Limbe Branch","AgencyLocation":"Down Beach, Sappa Road, Limbe","AgencyPhoneNumber":"+237222041690/222041693/691698628","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Kribi Branch","AgencyLocation":"Adjacent Auto Ecole Française Rue Petit Paris, Kribi","AgencyPhoneNumber":"+237222041691/222041692/691698632","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Akwa Branch","AgencyLocation":"Boulevard de la Liberté, Douala","AgencyPhoneNumber":"+237222041670/691698663","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Dakar Branch","AgencyLocation":"Marché Bilongué, Douala","AgencyPhoneNumber":"+237691698627","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Bambili Branch","AgencyLocation":"Three Corners, Bambili","AgencyPhoneNumber":"+237222054199/691697441","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Tchinga Branch","AgencyLocation":"Ave du 27 Août 1940,Yaounde","AgencyPhoneNumber":"691907381","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"},{"AgencyName":"Kumba Branch","AgencyLocation":"Kumba","AgencyPhoneNumber":"+237222041664","AgencyGPSCoordinates":"GPS Position","AgencyHours":"8:00-16:00"}]
非常感谢您的指导。
暂无答案!
目前还没有任何答案,快来回答吧!