Pascal
Pascal

Reputation: 275

Unable to open asset URL: file:///android_asset/www/

I get some error messages in Logcat when running my Android App, which was built using PhoneGap.

E/AndroidProtocolHandler(1475): Unable to open asset URL: file:///android_asset/www/css/mobile2.css
E/AndroidProtocolHandler(1475): Unable to open asset URL: file:///android_asset/www/scripts/custom.js
E/AndroidProtocolHandler(1475): Unable to open asset URL: file:///android_asset/www/scripts/customShare.js

Any ideas on how to fix this?

Upvotes: 25

Views: 54142

Answers (6)

Imaxo
Imaxo

Reputation: 23

I tried all options above but the issue still persisted.

Here was the fix that I figured out:

Go to Project -> Properties -> Resource -> Resource Filters and remove the Exclusion filters.

This should rebuild automatically and you'll be fine.

Upvotes: -1

Marcus
Marcus

Reputation: 181

In my case the problem was a underscore as a first letter in a folder name. I had:

file:///android_asset/html/_js

which I renamed to:

file:///android_asset/html/js

That fixed the problem.

Upvotes: 5

vbc
vbc

Reputation: 39

I have faced this issue and i have solved first i have placed my new.js file in asset-->www-->js-->new.js

after that i cut that file and placed in asset-->www-->new.js Now its working fine hope its help for you

Upvotes: 1

Ratna Halder
Ratna Halder

Reputation: 2004

I have faced same problem like you and I could not access and play video file from assets or raw file. After trying many more solution getting online, I could not resolve my problem. But,I have solved my problem by storing video file into mobile storage. Like:

<video id="video" autoplay="autoplay" width="640" height="360" controls>
    <source src=“file:///storage/emulated/legacy/Video/test.mp4”  type="video/mp4" />
</video>

Note: “file:///storage/emulated/legacy/Video/test.mp4” information will be changed as per your storage location.

Upvotes: 0

mastermind
mastermind

Reputation: 1057

If this error persist after adding permission then check case of file names

as

file names are Case Sensitive in phonegap app

Upvotes: 12

Joe Packer
Joe Packer

Reputation: 525

Check the path (where you are trying to access it) to insure that it is correct. You could also check the permissions on the file to insure that you can read/ write to the file. Hope this helps.

Upvotes: 21

Related Questions