我基于(gradle 1.10 和 gradle plugin 0.8)的 android 项目包含一个大型 android-library,它是 3 个不同 android-apps 的依赖项
在我的图书馆中,我希望能够使用这样的结构
if (BuildConfig.SOME_FLAG) {
callToBigLibraries()
}
因为 proguard 将能够根据 SOME_FLAG 的最终值减小生成的 apk 的大小
但我不知道如何使用 gradle 来做到这一点:
* the BuildConfig produced by the library doesn't have the same package name than the app
* I have to import the BuildConfig with the library package in the library
* The apk of an apps includes the BuildConfig with the package of the app but not the one with the package of the library.
我尝试使用 BuildTypes 和类似的东西没有成功
release {
// packageNameSuffix "library"
buildConfigField "boolean", "SOME_FLAG", "true"
}
debug {
//packageNameSuffix "library"
buildConfigField "boolean", "SOME_FLAG", "true"
}
为我的库和我的应用程序构建共享 BuildConfig 的正确方法是什么,这些应用程序的标志将在构建时被覆盖?