问题描述
根据,Android库包含一个'proguard .txt'文件。我的理解是,这个文件声明了库如何正确地被混淆和缩小。在我的情况下,我需要保留一些API类。
如何在库的build.gradle中声明库的proguard.txt文件?在创建使用我的库的应用程序(APK)时,该文件是否会自动读取?
我没有在Android的Gradle插件用户指南中找到这些信息。 p>
在您的Gradle文件的默而不是 proguardFiles
。例如:
defaultConfig {
consumerProguardFiles'proguard.txt'
}
code>
Android libraries, per the AAR file spec, includes a 'proguard.txt' file.My understanding is that this file declares how the library correctly can be obfuscated and minified. In my case I need to preserve some API-classes.
How can I declare the library's proguard.txt file in the library's build.gradle? And will this file be automatically read when creating an application (APK) that uses my library?
I didn't find this information in Android's Gradle Plugin User Guide.
解决方案
In your Gradle file's default configuration closure, specify your Proguard file with
consumerProguardFiles
instead of proguardFiles
. For example:
defaultConfig {
consumerProguardFiles 'proguard.txt'
}
这篇关于如何在我的Android库(AAR)中包含proguard配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!