CFXIXI工作室首页
CF西西的博客 | The connection to the server was unsuccessful.(file:///android_asset/www/index.html)

The connection to the server was unsuccessful.(file:///android_asset/www/index.html)

12. 四月 2012

 

原文:http://stackoverflow.com/questions/7633940/the-connection-to-the-server-was-unsuccessful-file-android-asset-www-index-h

 

question: 

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)".

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?

 

 

answer: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.

phonegap, andriod