When I run my Cordova app in the simulator, it loads alright (albeit extremely slowly, which is apparently a common complaint). I’m using jQuery Mobile, and owing to certain problems I have with JQM’s form methods and also to conflicts between JQM and Google Maps, my app is structured such that certain pages cause a whole DOM reload rather than the AJAX transition JQM normally induces. The app is taken to a separate html file entirely.
This works fine in iOS, but when I run it in the Android Emulator, I get “Application Error: A network error occurred. (file:///android_asset/www/nameOfPageIWasGoingTo.html?parameter1=34¶meter2=true)”
Cordova is re-included on each of these pages, and I placed the line
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
in my main .java file so that now the onCreate thing looks like:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
super.loadUrl("file:///android_asset/www/index.html");
}
Nevertheless, I have this error. Can anyone explain?
There is a bug in Android where the WebView fails to load pages if you try to pass parameters in the URL. Android is treating “nameOfPageIWasGoingTo.html?parameter1=34¶meter2=true” as a file name when it should load “nameOfPageIWasGoingTo.html” and pass the parameters along to the page. In the meantime you should use localStorage.setItem/getItem to pass parameters between pages.
In the mean time you should go star these issues:
https://code.google.com/p/android/issues/detail?id=17535
https://code.google.com/p/android/issues/detail?id=17327