1

I am using phonegap to develop an application which runs on android and iOS both. These two projects will share a www folder placed outside them. How to link the android project to the www folder? When I run my app, It throws Application Error A network error occurred. (file:///android_asset/www/page/main/main.html)

I have tried the solutions at this thread but no success

javasource:

super.loadUrl("file:///android_asset/www/page/main/main.html");
Community
  • 1
  • 1
Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165
  • Have you gone through all the setting of the PhoneGap project based on the information on their website.Can you provide your code of java class ? So we can tell you the solution of this error. – mpatel May 23 '13 at 09:02
  • Yes, I do. Everything is ok when I copy the folder www into android project. But how to link to external www folder? – Nguyen Minh Binh May 23 '13 at 09:03
  • Ok.You don't have index.html file in your www folder.You can see from the error that it's first time always search for the index.html in www folder.and in super.loadUrl() give path like file:///android_asset/www/index.html. – mpatel May 23 '13 at 09:10
  • Ah, yes, It just a typo when I posted my question. Please see my update – Nguyen Minh Binh May 23 '13 at 09:14

2 Answers2

0

Go through this question. They have faced similar error.May by you will get your answer.

First

second

Community
  • 1
  • 1
mpatel
  • 476
  • 3
  • 13
  • Not similar issue. They faced the error because they try to put som parameters in the url. My issue is that the webview doesn't find the webpage – Nguyen Minh Binh May 23 '13 at 09:20
  • Ok.Sorry for that.try second link that i have puted in answer. – mpatel May 23 '13 at 09:26
  • Sorry, It still doesn't work. My case seems special. I want to load the html file in `www` folder which is placed outside of project. – Nguyen Minh Binh May 23 '13 at 09:32
  • oh.:-( . No problem.I am right now also finding solution for this.As soon i will get the answer i will post here. – mpatel May 23 '13 at 09:44
  • Last One: Try this one. http://stackoverflow.com/questions/10223674/loading-html-file-from-local-folder-into-webview – mpatel May 23 '13 at 09:45
0

Finally found a solution at this blog: http://www.tricedesigns.com/2012/02/16/linked-source-files-across-phonegap-projects-on-osx/

Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165