Unknown Chromium -6 error while loading local images in Android Webview

I am working on a Worklight project that downloads a zip file, unpacks it and saves the files in the directory of specific platform documents (on iOS, NSDocumentDirectory , on Android I use getFilesDir() ). The file consists of one HTML file and several images located in a subdirectory (carrier). Download and unpack work fine on both platforms. After the unpacking process, I load the contents of the HTML file into an existing div (since this is a Worklight application, everything is in one HTML file).

Here everything gets complicated: The sources of image tags in the HTML file I uploaded refer to the HTML file (for example, "media / myimage.jpg"). When I embed the HTML file in the Worklight HTML file (which is in the package / application package), the base URL changes and the images cannot be found anywhere. I fixed this by writing my own functions that rewrite all image tags in the downloaded HTML file to indicate an absolute URL (iOS: /var/mobile/Applications/<identifier>/Documents/ , Android: /data/data/<id>/files/ ). This works fine on iOS, but on Android it only makes HTML load partially. LogCat then shows:

 Unknown chromium error: -6 

If I store the files as they are, the HTML loads correctly, but obviously with broken images. I also tried changing the URLs to file:///data/data/<id>/files/ [...] , which also causes HTML to not load completely. I really don't know what causes this problem. The app already has permission WRITE_EXTERNAL_STORAGE .

Does anyone have an idea how to fix this? Thanks!

+6
source share
1 answer

This error is caused by the presence of images wider than 1500 pixels. After reducing them, the error disappears. Probably a problem with Android web browsing.

+2
source

All Articles