Subdirectories on Android

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.

fixed

images can be on subdirectories ! --- scan the forums ! fixed as of many revisions ago on daily builds and release.

the only things that need to be in root for android are sound and movies...

lua files has to be on root but that is a corona must have.

c.

I'm using build 484. Testing on a Droid running 2.2 - I get a blank screen if I use an image subdirectory.

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.

Confirmed with another test project that this doesn't work.

--in main.lua:

--this works
bg = display.newImage( "test.png", true )

--rebuild with this instead, and move the image to /images folder:
bg = display.newImage( "images/test.png", true )

--get a black screen on the device (works in simulator)

The image is a simple RGB 8-bit from photoshop.

what bulid of corona are you using?

we fix this in the release.

c

I'm using build 484.

I also tried the following, but still get a blank screen:

bg = display.newImageRect("images/grid.png", 570, 380 );

are you on irc? am there right now....

is the actual file name lowercase? all lowercase? remember android and iphone the upper/lowecase has to match.

c

send me source or apk

I just tested the following code using build 484 on a Nexus One and it works fine.

1
2
3
4
5
6
7
img1 = display.newImage("images/gnc.png", 0, 0 );
img1.x = display.contentCenterX
img1.y = 50
 
img2 = display.newImageRect("images/gnc.png", 57, 57 );
img2.x = display.contentCenterX
img2.y = 200

Then how about spritesheet image? Last time i must drop it in same folder with the lua

> 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)

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.

Verified working. The problem was that my system was firing an old version of the simulator. Thanks.

@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!

Can you use multiple levels of sub directories or just one? Ex: images/levelone/pic.png

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.

@singh206 - try it. All file types except for audio/movies should work in subdirectories.

Have you tried a sample on the device? Try it.

C.

@carlos

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)

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.

@Tom

Thanks for that, it helps.

Is using the file system to access files in resource subdirectories something Ansca is working on, or is this permanently not an option for Android?

Can the file i/o on Android access subdirectories in the documents directory?

Android devices use a virtual file system so it's hard to work with. I don't know if subdirectories in the Resource directory will be supported in the future.

As far as I know, creating subdirectories at run-time is not supported in Corona.

@Tom

Thanks =' |

Hello,

I have built an app for Android using 2011.484 SDK version. My device is running Android 2.2. When I try to install .APK package file on device, I am getting 'INSTALL_FAILED_INVALID_APK' error. I was able to build for the same device using 2011.288 SDK. Please help!

Thanks

If your device is not running a ARMv7 processor, it's no longer supported starting with build 328.

Ok. Can you please send me the link to download Corona SDK older than 2011.328. So that I can test my app on my ARMv6 Android.

Thanks

Hello,

Does corona's latest SDK build support Cortex-A8 processor?
I am planning to buy a new device for testing my android apps.
If you have the list of the phones which corona's latest sdk does support, then please give it to me. Any help would be appreciated.

Thanks

Corona only supports processors that support the ARMv7 processor.
Here is a link to ARMv7 devices:
https://wiki.mozilla.org/Mobile/Platforms/Android

views:3382 update:2011/10/8 15:12:54
corona forums © 2003-2011