Bug? B4A 10.70 Webview LoadUrl('File') Problem ?

M-CAP7AIN

Member
B4A version 10.70 when compiled project in Release , webview load file problem :
B4X:
 WV.LoadUrl("file:///android_asset/asset/"&FILE_NAME)
The webpage at file:///android_asset/asset/file.html could not be loaded because: net::ERR_FILE_NOT_FOUND

but B4A version 10.20 work correctly.
 

Peter Simpson

Expert
Licensed User
Longtime User
Have you tried using something like this (From memory and NOT tested) XUI.FileUri(Dir, FileName)???
B4X:
WV.LoadUrl (XUI.FileUri(Dir, FileName))
Please note that I could be completely wrong with this answer, but it seems to ring a bell with me.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is related to the way the underlying packaging tool handles sub folders inside the assets folder.

This will work in release mode:
B4X:
WV.LoadUrl(XUI.FileURI(File.DirAssets, "asset\"&FILE_NAME))
If the html file references other files then the references will need to be updated. Best solution is to flatten the folders and put the files in the Files tab directly.
 
Last edited:

M-CAP7AIN

Member
i tested different methods. need urlEncode with
B4X:
WV.LoadUrl(XUI.FileURI(File.DirAssets, asset\"&FILE_NAME))

The html file was loaded but the resources in the file were not loaded.
 
Top