why this error in my PhoneGap app for Android ?

When run 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 a 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 app is just a bare bones demo type app, so far the only code in it is this javascript in the index.html file

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 was looking at other posts about similar errors and they all seem to suggest setting the java like so:

  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 it has been no help so far. Why am I getting these errors and what can I do about them? Thanks

Answers


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

Instead of:

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

Use:

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

Need Your Help

Using decorators on lambdas in Python?

python syntax lambda decorator

Is there any syntax for using a decorator on a lambda function in Python? Example:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.