mardi 24 février 2015

How do I exclude AndroidTest/assets from Gradle builds when not testing?

My unit tests require some large assets in order to test parsing complex media files. I'm noticing that Gradle includes the entire androidTest/assets folder in both debug and release builds. This is resulting in needless APK file size bloat.


I tried setting android { aaptOptions { ignoreAssetsPattern "!*.ext"} } in build.gradle for the media files' extension, but the androidTest/assets folder does not appear to honor these asset exclusion options.


I expect I can find some Gradle way to exclude the folder in release builds, but it probably shouldn't appear in a build unless I intend to use it specifically for running instrumentation tests. Is there a good option short of creating a new Gradle build flavor dimension? I already have more build variants than I would like.


I simply cannot believe the default behavior is to include androidTest/assets in all builds all of the time. Should this be considered a bug and be reported?


Aucun commentaire:

Enregistrer un commentaire