繁体   English   中英

代号一个应用程序无法为Windows构建

[英]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运行我的应用程序时,一切似乎都还不错,尽管控制台显示以下红色句子:

  1. 编译会强制符合支持的API /功能,以实现最大的设备兼容性。 这允许较小的代码大小和更广泛的设备支持

  2. 注意: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重新编译以获取详细信息。

  3. 注意: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重新编译以获取详细信息。

  4. 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM