I can not figure out how not to include certain resources (from the res folder) and classes (java) in the release apk.

Tried packagingOptions / exclude - does not throw out.

With proguard, I didn’t find the rules for this at all (although I could simply search badly)

    1 answer 1

    Just the resources and classes needed only for the debug build are not in the src / main but in the src / debug folder. For more complex build options, you can use flavors . In general , this link is all pretty detailed, except in English.

    • The option with src / debug does not work. More precisely, as for the app passes, but for either not. Let's explain. I have debug classes / resources (they show something, control ...) Accordingly, I use them in the application only for debug builds. But these are the classes I use in different projects, accordingly I brought them to lib (module) and connected to different projects via project(':xxx').projectDir = new File('xxxx') . And the only problem is that during the assembly, the release version is taken. Those. I don’t see the point of putting it in debug / release, respectively there are classes in the main either. Everything is working. - Yura Shinkarev
    • But these classes / resources are in both assemblies, and I need only in debug. Do you understand? How I can help flavor-s I do not quite understand. - Yura Shinkarev
    • Well, in the version with liby, then make a separate lib in which there will only be debugging resources and classes and connect it only for the debug build of the application - xkor
    • By the way, yes. For some reason, the easiest option and did not come to mind. - Yura Shinkarev
    • The only point (as I understand from the comments on stackoverflow.com/a/22442719/238089 ) is that it works with android libs, but with simple java libs not. But it doesn't matter to me, because I just have an android lib. - Yura Shinkarev