2

I want to exclude some packages from build path as they are not required by that flavour

I found this link that says to exclude class

But that requires 'java' plugin. If I apply java plugin it says it is not compatible with android plugin. So how do I exclude package from build.

I am using 'com.android.application' plugin.

Edit: WHY ?

I have got Product A consisting of feature 1, feature 2, feature 3. Now we want to create Project B containing only feature 1. Project C containing only feature 2.

I was able to achieve it partially by creating variant. But the apk for Project B and Project C is nearly as big as Project A. I need a way to remove unused code. Is there any way to achieve this ? Or should I be taking another approach ?

Community
  • 1
  • 1
  • The instructions in that link don't say anything about requiring the Java plugin. It should work fine. – Scott Barta Dec 03 '14 at 15:55
  • When I use java{ exclude } it says Gradle DSL method not found: 'java()'. Solution for that requires you to apply plugin 'java'. If I do that it reports a error saying that java plugin is incompatible with android plugin – theHumbleProgrammer Dec 04 '14 at 07:19
  • Sorry, I gave you bad information. What you want isn't implemented yet. I'm closing this as a duplicate of another SO question. – Scott Barta Dec 04 '14 at 17:07
  • In the question OP wants to exclude resources, i want to exclude java package. I have edited the question as to why I want to do this. Is there any other way to achieve what I am trying to do using Android Studio – theHumbleProgrammer Dec 05 '14 at 05:36
  • This is still a duplicate of that question. The source set is the same entity no matter whether it refers to Java sources or resource files. – Scott Barta Dec 05 '14 at 16:59
  • Ok. Is there any way that I can achieve the objective using Android Studio ? – theHumbleProgrammer Dec 06 '14 at 18:24
  • There's no easy way to do what you want. – Scott Barta Dec 08 '14 at 17:03

0 Answers0