Android Expansion.

hello. 

my app read local html file. 

so i added code

local html = {  “path.html”,

            path2.html",

            …

                    …

                }

function select_scene ()

    native.setActivityIndicator ( true ) 

    webView = native.newWebView( 0, 40, w, h )

    webView:request(htmlNumber, system.ResourceDirectory )

end 

function rowListener ( event )

    

    if event.phase == “release”   then

        htmlNumber = html[html number]

    end 

end 

testing result.

simulrator = ok 

ios = ok

android = ok 

my app is over the 50mb.

so i added code.

android =

        {

            usesExpansionFile = true,

            usesPermissions =

            {

                “android.permission.INTERNET”,

                “com.android.vending.CHECK_LICENSE”,

                                “android.permission.WRITE_EXTERNAL_STORAGE”, 

and build for google play beta test.

result 

file://android_asset/path.html then could not be loaded.

The requested file is not found.

what is wrong…my code.

I have exact same issue.

It seem that Corona is copying .html files to expansion file, but when “feeding” webview request method with destination of file, it doesn’t check expansion directory, it goes straight for resources directory.

Corona Labs - any thought on that?

Hi @delwing,

This might sound like a silly question, but have you enabled READ_EXTERNAL_STORAGE? I’ve asked the engineers about this, just in case that isn’t the solution, but in the meantime, can you confirm so?

Thanks,

Brent

The funny story is - I don’t. I have WRITE_EXTERNAL_STORAGE. But in permissions it states “read the contents of your USB storage”.

I will check it tomorrow, if it solves the problem.

There is also a READ_EXTERNAL_STORAGE

Rob

As I suspected. WRITE_EXTERNAL_STORAGE also gives READ_EXTERNAL_STORAGE permission without declaring it explicitly.

Adding it to build.settings didn’t give app any new permission and error still stands.

For clarification:

self.webView:request( “about.html” , system.ResourceDirectory )

Error in webview states:

file://android_asset/about.html then could not be loaded.

So it tries to load it from assets folder in APK, not extension file.

Hi @delwing,

This may be a bug then. Can you please file a bug report on this case?

http://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

I did file bug report.

But since it might take a while to solve it, is there any workaround to prevent .html file going to expansion file?

Or maybe is there any other extension except lua that won’t go to expansion file? Or maybe some other workaround?

EDIT:

system.pathForFile( “about.html” , system.ResourceDirectory ) also return wrong path to resource

IMO there should be way to exclude files from going to expansion file. It would save a lot of problems.

Please post the bug # that was emailed to you back to this thread for future reference.

Thanks

Rob

Bug report: Case 33998

Any progress in that issue? Or maybe there is a way to exclude file from going to expansion file just like new feature with excluding files from build?

This is major inconvenience that there is no way to control expansion file contents. 

Can you try renaming the .html file to .htmlx, and then see if you can extract it?  The extension shouldn’t matter to a native.newWebView() if that’s where you’re showing it.  If you need it named .html, then after it’s extracted, you can rename it.

The problem is that on Android, the .apk (and the expansion file) is a big .zip file. Android doesn’t unpack this zip file. Corona will extract out certain files when system.pathForFile() is called and .html is one that is not.  By renaming it .htmlx or something else, it will allow system.pathForFile() to do the extraction.

Rob

I was asking about webview issue.

But neither feeding webview with system.pathForFile with changed extension and simply changing extension doesn’t help. I am aware of that issue and did already try it.

I was hoping latest public release will fix it, but issue still remains.

Ideal solution would be allowing to exclude some files from going to expansion files. It will be useful not only this situation.

I have exact same issue.

It seem that Corona is copying .html files to expansion file, but when “feeding” webview request method with destination of file, it doesn’t check expansion directory, it goes straight for resources directory.

Corona Labs - any thought on that?

Hi @delwing,

This might sound like a silly question, but have you enabled READ_EXTERNAL_STORAGE? I’ve asked the engineers about this, just in case that isn’t the solution, but in the meantime, can you confirm so?

Thanks,

Brent

The funny story is - I don’t. I have WRITE_EXTERNAL_STORAGE. But in permissions it states “read the contents of your USB storage”.

I will check it tomorrow, if it solves the problem.

There is also a READ_EXTERNAL_STORAGE

Rob

As I suspected. WRITE_EXTERNAL_STORAGE also gives READ_EXTERNAL_STORAGE permission without declaring it explicitly.

Adding it to build.settings didn’t give app any new permission and error still stands.

For clarification:

self.webView:request( “about.html” , system.ResourceDirectory )

Error in webview states:

file://android_asset/about.html then could not be loaded.

So it tries to load it from assets folder in APK, not extension file.

Hi @delwing,

This may be a bug then. Can you please file a bug report on this case?

http://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

I did file bug report.

But since it might take a while to solve it, is there any workaround to prevent .html file going to expansion file?

Or maybe is there any other extension except lua that won’t go to expansion file? Or maybe some other workaround?

EDIT:

system.pathForFile( “about.html” , system.ResourceDirectory ) also return wrong path to resource

IMO there should be way to exclude files from going to expansion file. It would save a lot of problems.