excludeFiles not working on Android?

Just a tip. If you want to exclude all ‘@4x.png’ files in your asset folder, and your asset folder has a lot of sub-folders (see sample below), use this to exclude them.

The asset  folder has a lot of sub-folders :

asset/image1Folder asset/image2Folder

excludeFiles = { android = { "asset/\*/\*@4x.png" } }

Just bumping this old thread because it seems like files are still not being excluded from Android builds. Any word on a possible fix? Obviously this isn’t a deal-breaker or the highest priority, but I’d love to see it fixed someday if possible. Thanks!

Has anyone filed a bug report on this?

Thanks

Rob

Hi Rob: I can’t speak for anybody else, but I haven’t filed a bug report - it would be a tricky thing to compress into a small sample project, because the easiest way to demonstrate it is to have a folder with a bunch of good-sized files that you say you want to exclude. Those files get excluded on iOS builds, but not for Android builds, which is easily apparent because of the discrepancy in the APK file size vs. the .app file size. I had a private message conversation with Perry a few months ago, and provided some files at his request, but we never resolved the issue.

I can file a bug report, but I’m struggling with the best way to demonstrate the issue without over-complicating the sample project.

The size of the files wont matter.  The number of, paths to or exclusion patterns for the files might matter but that’s what I need a reproducible case for.  I tried to reproduce the issue with the info you sent last time but couldn’t (as I recall it wasn’t a self-contained project which I could just build without modification and whatever I had to do to make it build apparently made the bug go away).

To see what files are in an app you can do the following in a Terminal:

For an iOS app:

cd <directory-containing-built-app>

ls -R MyApp.app

For Android:

cd <directory-containing-built-apk>
unzip -l MyApp.apk

You can then demonstrate the problem with zero length files by comparing the lists of files in each build of the project.

Hi Perry,

Thanks for the info. I’ll prepare a sample project and submit a bug soon. Will post the case # here once it’s submitted.

IGNORE THIS POST - files are still being selectively excluded or not excluded on Android, but I was oversimplifying things, and I still don’t know why some files aren’t being excluded properly. Back to the drawing board.

A ha! I think I figured out the source of the bug. The way I structure my projects is thus: I have my project folder, and inside of that folder I have a folder called “workFiles” which contains all the various files I use to prepare the app that I don’t want to have included in the build. Accordingly, in my build.settings, I include the following:

excludeFiles = { all = { "workFiles/\*" }, iphone = {}, android = {}, },

Inside of that workFiles folder, I may have all manner of stuff: individual files, as well as additional subfolders. By excluding “workFiles/*”, I accomplish the following:

  • On iOS, everything gets excluded as expected (yay!)
  • On Android, some files get excluded, but not all. Here’s the breakdown:
    • All files (i.e. not subfolders) inside of “workFiles” get excluded
    • Subfolders that contain no spaces (i.e. “someSubfolder”) also get excluded
    • Subfolders that contain spaces (i.e. “some other subfolder”) DO NOT get excluded

I am generating a sample project that exhibits this and will be submitting a bug shortly. Hopefully we’ll get it squashed soon.

Thanks,

Jason

I have a similar problem, but my subdirectories do not have spaces.

iOS build: 124 mb

Android build: 442 mb 

Ok, I see the problem now.  Officially * only matches filenames and not directories (per the documentation).  On OS X this it is interpreted somewhat more liberally and has the effect you want but the Android build tools are stricter.

For Android, you can specify ** to match directories as well though I notice that this seems to make iOS builds include all the directories (but none of the files) for some odd reason which isn’t optimal.

Probably the best thing for you to do for now is to use the following file exclusion spec and I’ll see what I can do to tidy things up:

excludeFiles = &nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all = { }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iphone = { "workFiles/\*" }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android = { "workFiles/\*\*" }, &nbsp;&nbsp; },

Perry, you are my personal hero! And shame on me for not more closely reading the documentation. Thanks so much!

Just bumping this old thread because it seems like files are still not being excluded from Android builds. Any word on a possible fix? Obviously this isn’t a deal-breaker or the highest priority, but I’d love to see it fixed someday if possible. Thanks!

Has anyone filed a bug report on this?

Thanks

Rob

Hi Rob: I can’t speak for anybody else, but I haven’t filed a bug report - it would be a tricky thing to compress into a small sample project, because the easiest way to demonstrate it is to have a folder with a bunch of good-sized files that you say you want to exclude. Those files get excluded on iOS builds, but not for Android builds, which is easily apparent because of the discrepancy in the APK file size vs. the .app file size. I had a private message conversation with Perry a few months ago, and provided some files at his request, but we never resolved the issue.

I can file a bug report, but I’m struggling with the best way to demonstrate the issue without over-complicating the sample project.

The size of the files wont matter.  The number of, paths to or exclusion patterns for the files might matter but that’s what I need a reproducible case for.  I tried to reproduce the issue with the info you sent last time but couldn’t (as I recall it wasn’t a self-contained project which I could just build without modification and whatever I had to do to make it build apparently made the bug go away).

To see what files are in an app you can do the following in a Terminal:

For an iOS app:

cd <directory-containing-built-app>

ls -R MyApp.app

For Android:

cd <directory-containing-built-apk>
unzip -l MyApp.apk

You can then demonstrate the problem with zero length files by comparing the lists of files in each build of the project.

Hi Perry,

Thanks for the info. I’ll prepare a sample project and submit a bug soon. Will post the case # here once it’s submitted.

IGNORE THIS POST - files are still being selectively excluded or not excluded on Android, but I was oversimplifying things, and I still don’t know why some files aren’t being excluded properly. Back to the drawing board.

A ha! I think I figured out the source of the bug. The way I structure my projects is thus: I have my project folder, and inside of that folder I have a folder called “workFiles” which contains all the various files I use to prepare the app that I don’t want to have included in the build. Accordingly, in my build.settings, I include the following:

excludeFiles = { all = { "workFiles/\*" }, iphone = {}, android = {}, },

Inside of that workFiles folder, I may have all manner of stuff: individual files, as well as additional subfolders. By excluding “workFiles/*”, I accomplish the following:

  • On iOS, everything gets excluded as expected (yay!)
  • On Android, some files get excluded, but not all. Here’s the breakdown:
    • All files (i.e. not subfolders) inside of “workFiles” get excluded
    • Subfolders that contain no spaces (i.e. “someSubfolder”) also get excluded
    • Subfolders that contain spaces (i.e. “some other subfolder”) DO NOT get excluded

I am generating a sample project that exhibits this and will be submitting a bug shortly. Hopefully we’ll get it squashed soon.

Thanks,

Jason

I have a similar problem, but my subdirectories do not have spaces.

iOS build: 124 mb

Android build: 442 mb 

Ok, I see the problem now.  Officially * only matches filenames and not directories (per the documentation).  On OS X this it is interpreted somewhat more liberally and has the effect you want but the Android build tools are stricter.

For Android, you can specify ** to match directories as well though I notice that this seems to make iOS builds include all the directories (but none of the files) for some odd reason which isn’t optimal.

Probably the best thing for you to do for now is to use the following file exclusion spec and I’ll see what I can do to tidy things up:

excludeFiles = &nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all = { }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iphone = { "workFiles/\*" }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android = { "workFiles/\*\*" }, &nbsp;&nbsp; },

Perry, you are my personal hero! And shame on me for not more closely reading the documentation. Thanks so much!