Can't load images in webview on Android

Hi everyone,

I recently made a nice app with 200 MB pictures included. With testing and uploading it directly to my Android everything worked fine (also the loading of the pictures). Once I tried uploading to the Play Store I was told that my app was too big… So I split it up into an OBB, uploaded it again. The app worked, but…

I make custom html pages which load images from my fotos folder. All my pictures used in the htmls don’t load anymore, all I see is a nice questionmark.

I load all my pictures with file:///android_asset/ in the file path, but no luck. I have tried several combinations but it just won’t work.

Can anyone tell me what I am doing wrong? I need to deliver this app before I can send my invoice!

These are my vars in the build.settings

android =

  {

        versionCode = “14”,

        usesExpansionFile = true,

        usesPermissions =

        {

            “android.permission.INTERNET”,

            “android.permission.READ_EXTERNAL_STORAGE”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            “android.permission.ACCESS_FINE_LOCATION”,

            “android.permission.ACCESS_COURSE_LOCATION”,

      “com.android.vending.CHECK_LICENSE”,

      “com.android.vending.BILLING”,

        },

supportsScreens = {    smallScreens = false,    normalScreens = false,    largeScreens = true,    xlargeScreens = true,},

    },

Please help!

I heard that there is a bug that prevents local html pages from working correctly when using expansion files.

I don’t have a link to the thread, but you are not alone. This has been an issue for a while now afaik.

thanks for your reply,

what is bugging me that it works 100% when I render it without 

usesExpansionFile = true,

and I do not upload it via Google Play, but direct to my android.

So what happens to the file paths after the apk is split up?

Corona please help!

We just experienced this unfortunately and apparent bug in Corona.  We’ve been loading HTML pages from the root of the ResourceDirectory into webviews for a while now and just experienced this break ONLY with app builds that use expansion files.

Case 36272) webview cannot loading HTML files from ResourceDirectory when running an .apk   that uses expansion files

UPDATE:  Using Corona SDK 2458, we are able to get the .html file to load BUT the images referred to appear as broken image links:

Example:

\<img src="SPMTM\_FRC\_WebOverlay\_Help\_nav.2.png" width="800" height="600" alt="Small Potatoes Magic Toy Maker Main Screen" /\>

Hi,

I managed to solve it by temporarily moving images to the Documents Directory and deleting them when loading another page.

I contacted the helpdesk, and they told me they are going to fix it, but at an undisclosed date…

+1

Now I also have this problem. 

I have to do an upgrade of an app that has 100 pages in local html. 

With previous versions of Corona ( 2354) everything worked perfectly also with android. 

Now with the latest build I have this problem. The html files appear without images. 

I can not use the build in 2354 because now it crashes with the OSX 10.9

The app is less than 50 megabytes

I filed a very specific example of this problem as a bug: Case 36534

Now I seriously need to find a workaround for it.  I’m toiling to do so and will post whatever solution I can find here for everyone’s benefit.

Hi t,

this is what I did:

I managed to solve it by temporarily moving images to the Documents Directory and deleting them when loading another page.

 

  1. I extract the images I need from the source using a regular expression.

Hi t,

this is what I did:

I managed to solve it by temporarily moving images to the Documents Directory and deleting them when loading another page.

 

  1. I extract the images I need from the source using a regular expression.

  2. I move those images to the Documents Directory

 

Hi T.

this is what I did:

  1. Extract the urls of the images needed out of the source of my html.

  2. I moved them to the documents directory

  3. I could then load them!

I’ve tried to work around this by renaming the .png files to .pngx (just in case the issue was related to the warning about certain file types found here: http://docs.coronalabs.com/api/library/system/ResourceDirectory.html) but that does NOT workaround the bug in Corona.

You have to rename the .png to png.txt in the ResourceDirectory.

Then after the move to the DocumentsDirectory change the filename back to .png!

I heard that there is a bug that prevents local html pages from working correctly when using expansion files.

I don’t have a link to the thread, but you are not alone. This has been an issue for a while now afaik.

thanks for your reply,

what is bugging me that it works 100% when I render it without 

usesExpansionFile = true,

and I do not upload it via Google Play, but direct to my android.

So what happens to the file paths after the apk is split up?

Corona please help!

We just experienced this unfortunately and apparent bug in Corona.  We’ve been loading HTML pages from the root of the ResourceDirectory into webviews for a while now and just experienced this break ONLY with app builds that use expansion files.

Case 36272) webview cannot loading HTML files from ResourceDirectory when running an .apk   that uses expansion files

UPDATE:  Using Corona SDK 2458, we are able to get the .html file to load BUT the images referred to appear as broken image links:

Example:

\<img src="SPMTM\_FRC\_WebOverlay\_Help\_nav.2.png" width="800" height="600" alt="Small Potatoes Magic Toy Maker Main Screen" /\>

Hi,

I managed to solve it by temporarily moving images to the Documents Directory and deleting them when loading another page.

I contacted the helpdesk, and they told me they are going to fix it, but at an undisclosed date…

+1

Now I also have this problem. 

I have to do an upgrade of an app that has 100 pages in local html. 

With previous versions of Corona ( 2354) everything worked perfectly also with android. 

Now with the latest build I have this problem. The html files appear without images. 

I can not use the build in 2354 because now it crashes with the OSX 10.9

The app is less than 50 megabytes

I filed a very specific example of this problem as a bug: Case 36534

Now I seriously need to find a workaround for it.  I’m toiling to do so and will post whatever solution I can find here for everyone’s benefit.

Hi t,

this is what I did:

I managed to solve it by temporarily moving images to the Documents Directory and deleting them when loading another page.

 

  1. I extract the images I need from the source using a regular expression.

Hi t,

this is what I did:

I managed to solve it by temporarily moving images to the Documents Directory and deleting them when loading another page.

 

  1. I extract the images I need from the source using a regular expression.

  2. I move those images to the Documents Directory