Search code examples
androidbuildcompilationaar

Exclude .java class to be compiled to .aar file


I am building a Android library(.AAR) which is consist of multiple packages. Is there any way to exclude some classes from been compiled to the library?


Solution

  • Answer found.

    sourceSets {
            main {
                java {
                    exclude '**/className.java'
                }
            }
        }