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: Copy
 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.
 
Have you tried using something like this (From memory and NOT tested) XUI.FileUri(Dir, FileName)???
Code: Copy
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.
 
It is related to the way the underlying packaging tool handles sub folders inside the assets folder.

This will work in release mode:
Code: Copy
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:
Back
Top