科尔多瓦与服务器的连接不成功 [英] Cordova Connection to server was Unsuccessful
问题描述
来连接服务器失败(文件:///android-asset/www/index.html)
是显示。
请让我知道如何解决这个问题。
is showing when i run my android application. please let me know how to resolve this issue.
推荐答案
这可能会在这里问了很多次..
这个问题可以通过添加超时web视图调用(的index.html)修复。在你project_name.java类只需添加此
This may asked here many times.. This issue can fix by adding a timeout to the webview call (index.html). In your project_name.java class just add this
super.setIntegerProperty("loadUrlTimeoutValue", 5000);
和科尔多瓦最新的,只要使用此超时
And in Cordova latest, just use this to timeout
super.loadUrl(Config.getStartUrl(), 5000);
另外通过这些所谓的问题
Also go through these so questions
<一个href=\"http://stackoverflow.com/questions/12319809/application-error-the-connection-to-the-server-was-unsuccessful-file-andr\">Question1
<一个href=\"http://stackoverflow.com/questions/7633940/the-connection-to-the-server-was-unsuccessful-file-android-asset-www-index-h\">Question2
更新:
还有一个解决办法,试试这个
One more solution, try this
创建一个main.html中,把你的code那里,并在您的index.html只是重定向到main.html中
Create a main.html and put your code there, and in your index.html just redirect to main.html
<script>
window.location='./main.html';
</script>
这篇关于科尔多瓦与服务器的连接不成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!