混淆.aar文件 [英] Obfuscating the .aar files
问题描述
我已使用
./gradlew assemble
我通过设置minify == true启用了混淆功能
I have enabled obfuscating by setting minify == true
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
但是,当我在启用minify = true的情况下运行上述gradle命令时,得到java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
However when I run the mentioned gradle command with minify enabled = true, I get java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
此错误指向什么?如何混淆库.aar文件?
What does this error pointing to and how can I obfuscate the library .aar file?
最好的问候
推荐答案
Proguard削减未使用的类.图书馆是独立的产品,并且具有一些特定的切入点,这些切入点不应被遗忘.因此,您需要添加规则以保留此入口点.规则如下:
Proguard cuts unused classes. Libraries are standalone products, and has some specific entry points, which should not be obfsuscated. So you need to add rules to keep this entry points. Rules lookes like this:
-keep class packagename {public *;}
这篇关于混淆.aar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!