Why is this error in my PhoneGap app for Android?

When running in the emulator (using Phonegap 1.1.0, Mac 10.6, Eclipse 3.7.1) I get this error:

12-01 11:49:12.936: D/chromium(1062): Unknown chromium error: -6 ... 12-01 11:49:13.476: I/System.out(1062): onReceivedError: Error code=-1 Description=A network error occurred. URL=file://android_asset/www/index.html 

and on the device I get this error:

 12-01 11:50:37.644: I/System.out(5319): onReceivedError: Error code=-14 Description= The requested file was not found. /android_asset/www/index.html (No such file or directory) URL=file://android_asset/www/index.html 

My application is just a bare-bone demo application, so far its only code is this javascript in index.html

 function onBodyLoad() { document.addEventListener("deviceready",onDeviceReady,false); } function onDeviceReady() { document.addEventListener("resume", onResume, false); onResume(); } function onResume(){ openBrowser('http://www.mysite.com/wap'); //navigator.app.exitApp(); } function openBrowser(url){ // document.location= url; } 

I looked at other posts about similar errors, and all of them seem to suggest installing java:

  public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setStringProperty("loadingDialog", "Title,Message"); this.setIntegerProperty("loadUrlTimeoutValue", 70000); // setContentView(R.layout.main); super.loadUrl("file://android_asset/www/index.html"); } 

or something like that, but so far it has not helped. Why am I getting these errors and what can I do about them? Thanks

+4
source share
1 answer

I needed three slashes after this: super.loadUrl("file:

Instead:

 super.loadUrl("file://android_asset/www/index.html"); 

Using:

 super.loadUrl("file:///android_asset/www/index.html"); 
+5
source

Source: https://habr.com/ru/post/1384158/


All Articles