XDK 构建的应用程序无法正常工作

XDK built app not working

我搜索了很多,但找不到答案。我使用 Intel XDK 进行 Cordova/Phonegap 开发。

一切正常(模拟选项卡、调试等)。我转到构建选项卡并获取我的 .apk,将其移动到 SD 卡并安装,但是,它在 运行.

时不起作用

如果我使用 Phonegap Build(在线)构建源代码,一切正常。

我的JS代码:

<script type="text/javascript">

    document.addEventListener("backbutton", function(){ return; }, true);
    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() 
    {
        //navigator.splashscreen.hide();
        var server = 'http://xxxxxx/index.php?';
        var user_uuid = device.uuid;
        $( document ).ready
        (
            function()
            {
                $("#main_content").css("top", "50%");
                $("#main_content").css("margin-top", "-"+($("#main_content").height()/2)+"px");
                $("#main_content").show();
                $("#big_img_load").attr("src", "img/ajax-loader.gif");
                var xinv = setInterval
                (
                    function()
                    {
                        var networkState = navigator.connection.type;
                        if(networkState.trim() == 'none')
                            $("#no_internet").show(); 
                        else 
                        {
                            $.post
                            (
                                server+"do=boot",{useruuid: user_uuid},function(data)
                                {
                                    if(data.trim() != "ok")
                                        window.location = "error.html";
                                    else
                                    {
                                        clearInterval(xinv);
                                        window.location = "app.html";
                                    }
                                }
                            );
                        }
                    },
                    1000
                );
            }
        );
    };

</script>

它仍在加载中:没有互联网检查,没有 POST 到 URL,什么都没有。

问题出在哪里?为什么仅从 XDK 构建不起作用?

我怀疑您没有为您的应用正确设置构建设置中的域白名单部分。请参阅这篇文章以获取一些提示:https://software.intel.com/en-us/articles/cordova-cli-412-domain-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps 并确保使用 Crosswalk 而不是 Android 构建您的应用,以便在 Android 设备上获得最佳效果。