An Android APK is really a zip file. The files in the resource directory are inside the APK file, therefore they are compressed within a zip file. The Lua io API such as io.open() is unable to open/extract files inside a zip file, thus it cannot open files within an APK. This is true of the io API on all platforms (Mac, Windows, iOS, and Android).
Now, the reason that the Lua io API can access resource files from an iOS package is because it is NOT a compressed file. The iOS package file contains its own directory structure which you can get an absolute path to its contained files that are accessible in the C language, which is what the Lua runtime is written in.
So, this presents an interesting problem with Android APKs. The C/C++ side of Corona and the Lua runtime are unable to access resource files within the APK because it is really a zip file. We have to access these files differently than how we do it compared to files outside of the APK. We do access these files via special Android function calls on the Java side. We've set up our Ansca made Corona APIs to be able to identify if it is a file within the APK or outside of the APK and open it seamlessly for you. However, the Lua "io" API was not made by Ansca but by the developers of Lua, so it has no understanding of what an APK is and how to access its contained files. So I hope this makes the problem clear to you.
That said, we've implemented some special handling. Calling system.pathForFile() on certain file types will cause Corona to automatically extract that file and copy it to an outside directory. It's a hack, not a good solution because it is wasteful on storage space, but it allows Lua io APIs to access certain file types.
system.pathForFile() will auto-extract all file types EXCEPT the following:
- *.html- *.htm- *.3gp- *.m4v- *.mp4- *.png- *.jpg- *.ttfThis means that the above file types cannot be accessed by Lua io API. All other files will be automatically extracted when calling system.pathForFile() first. This is also why you can't access your HTML file. The reason that the HTML file is not auto-extracted is because typically images are linked to it as well so Corona would have to auto-extract image files too to make the web page appear correctly... but we definitely don't want to do this because images typically take a huge amount of space on storage.