Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Error Is a directory (file:///#android_asset/www/index.html)

I'm using phonegap to develop an application on android, when I test it on my phone I get this error Application Error Is a directory (file:///#android_asset/www/index.html) I only get this error when I don't have internet connection on my phone.

any suggestions?

like image 755
Vanddel Avatar asked Mar 20 '13 21:03

Vanddel


People also ask

How do I fix No such file or directory error?

To solve No Such File Or Directory Error in Python, ensure that the file exists in your provided path. To check all the files in the directory, use the os. listdir() method.

How do you fix an error occurred while attempting to create the directory?

If your Windows 10 computer says that an error occurred while creating the directory, make sure to use an admin account. Then go to Windows Security settings and disable Controlled folder access. If the issue persists, disable your antivirus and firewall and install the problematic program again.

What does it mean when it says the file or directory is corrupted and unreadable?

The error "File or directory is corrupted and unreadable" is a kind of fundamental error. This occurs when corrupted files in response to malware affect your file system. However, to recover the lost data from those directories, you need to use a professional tool.


2 Answers

This means, in your index.html, you are using a resource that requires internet access. See your index.html and look for any CSS, javascript or Cordova file that is linked directly from the internet. If so, you must download the related file and make it local.

I had this same problem when I linked my Jquery mobile JS file directly like this:

<script type="CSS/javascript" src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.js">

what I did was, downloaded the jquery.mobile-1.3.0.js file and had it placed locally inside my www folder. That fixed my problem.

like image 107
GenieWanted Avatar answered Sep 25 '22 03:09

GenieWanted


I found the answer here: http://dev.wavemaker.com/wiki/bin/wmdoc_6.5/PhoneGap?xpage=print#HTheconnectiontotheserverwasunsucessful28file3A2F2F2Fandroidasset2Fwww2Findexhtml29

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

WHERE: When launching the application on an Android device.

Anything you place within your index.html file that requests a remote resource will cause the above error to be thrown for android devices, and your application will then die. The Weinre debugger is a common cause of this error.

Solution: Move the loading of remote resources out of index.html and into your application where it will fail quietly.

like image 21
Vanddel Avatar answered Sep 27 '22 03:09

Vanddel