到服务器的连接失败(文件:///android_asset/www/index.html)。 [英] The connection to the server was unsuccessful.(file:///android_asset/www/index.html)

查看:2070
本文介绍了到服务器的连接失败(文件:///android_asset/www/index.html)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用PhoneGap的一个Android应用程序,它调用了一个网站(http://siteaddress.com:8081)来获得JSON EN codeD数据。这是工作的罚款在模拟器上,然后我建了Android包.apk文件使用的PhoneGap构建文件,但是当我在我的Andr​​oid手机安装了这个包,并启动了应用程序,它的力量关闭显示错误与服务器连接的应用程序是。不成功的(文件:///android_asset/www/index.html)。

I am developing a android app using phonegap, it calls a website (http://siteaddress.com:8081) to get json encoded data. This is working fine on the emulator, then I built the android package .apk file using phonegap build but when i installed this package on my android phone and started the app, it force closes the application showing the error "The connection to the server was unsuccessful.(file:///android_asset/www/index.html)".

我已经建立了使用的PhoneGap构建应用程序,通过它的index.html,以及尝试了.zip文件包,但仍然得到这个错误。我试图寻找这个错误,还包括以下code。在我的应用程序的建议对某些网站,但它仍然是给错误。

I have built the app using phonegap build, passed it the index.html as well as tried the .zip file package but still getting this error. I tried searching for this error and also included the below code in my app as suggested on some sites but still it is giving error.

super.setBooleanProperty("loadInWebView", true);
super.setIntegerProperty("loadUrlTimeoutValue", 60000);

有这样几件事你必须做的,我想从我的应用程序来调用网站?我试图在移动浏览器中打开该网站,但它并没有打开,但该网站工作正常桌面浏览器。有什么不对,我是在做什么?

Has this got something to do with the website that i am trying to call from my app? I tried opening that site in the mobile browser but it didn't opened but the website works fine on a desktop browser. Is there something wrong that i am doing?

推荐答案

我使用的是猜测它的端口号。您是否尝试过使用端口80用于服务器,而不是8081?它可能是端口是不是你的设备上打开。

I'm guessing its the port number your using. Have you tried using port 80 for your server rather than 8081? Its possible that port isn't open on your device.

这篇关于到服务器的连接失败(文件:///android_asset/www/index.html)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆