[英]codename one app doesn't build for windows
我正在嘗試為Windows Phone構建我的應用程序,但是代號一生成服務器卻給了我生成錯誤。 這是錯誤日志: https : //s3.amazonaws.com/codenameone-build-response/7e34c6a4-f939-4044-8ab3-afbad45e7447-1450100218601-error.txt
當我為Android構建它時,一切都很好。
當我從NetBeans運行我的應用程序時,一切似乎都還不錯,盡管控制台顯示以下紅色句子:
編譯會強制符合支持的API /功能,以實現最大的設備兼容性。 這允許較小的代碼大小和更廣泛的設備支持
注意:C:\\ Users \\ Andrius \\ Documents \\ NetBeansProjects \\ dogspuppiesforsaleApp \\ src \\ userclasses \\ StateMachine.java使用或覆蓋不推薦使用的API。 注意:有關詳細信息,請使用-Xlint:deprecation重新編譯。 注意:C:\\ Users \\ Andrius \\ Documents \\ NetBeansProjects \\ dogspuppiesforsaleApp \\ src \\ userclasses \\ StateMachine.java使用未經檢查或不安全的操作。 注意:使用-Xlint:unchecked重新編譯以獲取詳細信息。
注意:C:\\ Users \\ Andrius \\ Documents \\ NetBeansProjects \\ dogspuppiesforsaleApp \\ src \\ userclasses \\ StateMachine.java使用或覆蓋不推薦使用的API。 注意:有關詳細信息,請使用-Xlint:deprecation重新編譯。 注意:C:\\ Users \\ Andrius \\ Documents \\ NetBeansProjects \\ dogspuppiesforsaleApp \\ src \\ userclasses \\ StateMachine.java使用未經檢查或不安全的操作。 注意:使用-Xlint:unchecked重新編譯以獲取詳細信息。
Grd 14,2015 3:44:25 PM java.util.prefs.WindowsPreferences警告:無法在根0x80000002處打開/創建prefs根節點Software \\ JavaSoft \\ Prefs。 Windows RegCreateKeyEx(...)返回了錯誤代碼5。
一位代號管理員告訴我,Windows Phone的3d陣列有問題。 我在我的應用程序中使用JSON數據,所以問題可能出在這里?
protected void setCategories() {
JParser parser = new JParser("http://www.url.com/mobileApp/categories.php");
this.resultArray = parser.returnArray();
for (int i = 0; i < this.resultArray.length(); i++) {
try {
JSONObject jsonObject = this.resultArray.getJSONObject(i);
categories.add(new Category(jsonObject.getInt("id"), jsonObject.getString("title")));
} catch (JSONException ex) {
Dialog.show("Error", ex.toString(), "Ok", null);
}
}
}
JParser類:
public class JParser {
public ConnectionRequest r;
public JSONArray jsonArray;
public String url;
public JParser(String url) {
this.jsonArray = new JSONArray();
this.url = url;
this.r = new ConnectionRequest() {
@Override
protected void readResponse(InputStream input) throws IOException {
JSONParser p = new JSONParser();
Hashtable h = p.parse(new InputStreamReader(input));
try {
String hashString = h.toString();
JSONObject entries = new JSONObject(hashString);
JSONArray rez = new JSONArray();
rez = entries.getJSONArray("root"); //musu JSON objektas visada prasides su root
setArray(rez);
} catch (JSONException ex) {
System.out.println(ex);
Dialog.show("Error", ex.toString(), "Ok", null);
}
}
};
this.r.setUrl(this.url);
this.r.setPost(false); //nieko nepostinam, tik pasiimam parsinti
InfiniteProgress prog = new InfiniteProgress(); //nesibaigiantis procesas
Dialog dlg = prog.showInifiniteBlocking(); //rodom dialoga su loading
this.r.setDisposeOnCompletion(dlg); //kai baigia krauti, isjungiam
NetworkManager.getInstance().addToQueueAndWait(this.r); //pridedam i eile
this.r.getResponseData(); //gaunam duomenis
}
public void setArray(JSONArray a) {
this.jsonArray = a;
}
public JSONArray returnArray() {
return this.jsonArray;
}
}
我真的不能告訴你哪里出錯是來自但是你可以重寫你的代碼來讀取響應readResponse()
過程JSON響應postResponse()
和無JsonArray(),請嘗試以下:
public class JParser {
public ConnectionRequest r;
public String url;
public JParser(String url) {
this.url = url;
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
try {
this.r = new ConnectionRequest() {
Map response = null;
@Override
protected void readResponse(InputStream input) throws IOException {
JSONParser parser = new JSONParser();
response = parser.parseJSON(new InputStreamReader(input));
}
@Override
protected void postResponse() {
List responseList = (List) response.get("root");
if (responseList != null) {
// save or use your response as a list here, for exampple:
System.out.println(responseList.toString()); // output for debug
// Or even loop through the result:
for (Object resList : responseList) {
Map tempHash = (Map) resList;
String result = tempHash.get("anElementInsideRoot").toString();
System.out.println(result);
}
} else {
//It returns null value
}
}
};
this.r.setUrl(this.url);
this.r.setPost(false);
NetworkManager.getInstance().addToQueueAndWait(this.r);
} catch (Exception ex) {
System.out.println(ex.getMessage());
Dialog.show("Error", ex.getMessage(), "Ok", null);
} finally {
dlg.dispose();
}
}
}
同時刪除this.r.getResponseData();
不需要
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.