Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude BuildConfig.class from Android library jar in Gradle

Tags:

android

gradle

When building an Android Library Project with Gradle, what's the correct way to exclude BuildConfig.class from the resulting .jar?

like image 239
yanchenko Avatar asked Nov 01 '22 19:11

yanchenko


2 Answers

Solved with android.packageBuildConfig = false which is deprecated according to http://tools.android.com/tech-docs/new-build-system

like image 98
yanchenko Avatar answered Nov 09 '22 08:11

yanchenko


here is a way to exclude from AAR:

apply plugin: 'com.android.library'

afterEvaluate {
  generateReleaseBuildConfig.enabled = false
}

here is the source from reddit

like image 41
guness Avatar answered Nov 09 '22 08:11

guness