I know this topic has been discussed (that you can’t put images, sounds, etc. in subdirectories if you want to deploy to Android), but all I’ve seen is that it’s a “known bug”.
My question is, is this going to be fixed, or is it something that will always be a problem? It hurts my eyes every time I look at a root directory with tons of files in it, so I’m wondering if I need to get used to it or hold out hope that the issue will get fixed. [import]uid: 52127 topic_id: 9139 reply_id: 309139[/import]
I’m using build 484. Testing on a Droid running 2.2 - I get a blank screen if I use an image subdirectory. [import]uid: 52127 topic_id: 9139 reply_id: 33430[/import]
did you do the typical checklist
image has to be rgb color 8 bit
image cannot have icc embedded profile
image cannot have reserved java names
image cannot have _ # or weird characters
if two or more files have the same name but different extensions that wont work
correct uppercase/lowercase - devices enforce that casing musth match
c. [import]uid: 24 topic_id: 9139 reply_id: 33434[/import]
> the only things that need to be in root for android are sound and movies…
@Carlos: Why is this discrimination about sound files?
When will this be fixed?
We really need this, as our game has a LOT of sound files currently placed in subfolders (works fine on iOS) [import]uid: 9058 topic_id: 9139 reply_id: 33540[/import]
There is currently no fix in the works for allowing sound or video files in subfolders.
The problem is how Android treats media files and moves them to an internal RES folder in the APK (which we have no control over). Android doesn’t have a file structure like iOS and everything is packed in to a “zip” type file so it makes it difficult to deal with. [import]uid: 7559 topic_id: 9139 reply_id: 33590[/import]
Verified working. The problem was that my system was firing an old version of the simulator. Thanks. [import]uid: 52127 topic_id: 9139 reply_id: 33614[/import]
@Tom: I see, but what about AssetManager. It has access to folder structure from /assets folder. Placing all audio and video files into asset folder is better that raw file structure.
Please, comment. Thanks! [import]uid: 9058 topic_id: 9139 reply_id: 34244[/import]
So this only applies to images loaded via display.newImage()?
What about text files, and other file-types? I need to read text files from deeply nested resource subdirectories. [import]uid: 4596 topic_id: 9139 reply_id: 35278[/import]
I’ve been able to load files from subdirectories in the simulator, but on devices I’m getting errors that say the files don’t exist. This is using system.pathForFile, and io.open.
W/System.err(18782): java.io.FileNotFoundException: /data/data/com.test.app/files/coronaResources/test/afile.xml (No such file or directory) [import]uid: 4596 topic_id: 9139 reply_id: 35308[/import]
The file i/o on Android cannot access subdirectories. The only thing you can use in subdirectories are image files and they can only be accessed with the display.newImage and display.newImageRect APIs.
Here is a list of things that you can and cannot do with files on Android devices. I will add this to our formal documentation.
What you CANNOT do:
Use the file system to access files in subdirectories (off the Resource directory)
Use the file system to access image or html files in Resource directory
Have sound files in subdirectories
Have sound files with the same name but different extensions in the Resource directory
native.webPopups can’t access local html files in the Documents or Temporary directories (Note: This has been fixed in our daily builds.)
What you CAN do:
Display images from the Resource directory
Display images from subdirectories (off the Resource directory)
Display images from the Documents and Temporary directories
Play sound files from Resource, Documents, and Temporary directories (using openAL API)
Use the file system to access: txt, xml, sound, ppp and db files in the Resource directory (I don’t have a complete list but for now only image and html files seem restricted)
Copy the above files from the Resource directory to the Documents or Temporary directory
Copy image and html files from the Resource directory to the Documents or Temporary directory by changing the file extension (e.g., ppp) and renaming it back to the original file name after the copy.
None of the above limitations apply to iOS devices or the Mac and Windows Simulator.
[import]uid: 7559 topic_id: 9139 reply_id: 35313[/import]