diff --git a/docs-source/src/en/config/r8-proguard.md b/docs-source/src/en/config/r8-proguard.md index 00b12e1..37d697a 100644 --- a/docs-source/src/en/config/r8-proguard.md +++ b/docs-source/src/en/config/r8-proguard.md @@ -3,4 +3,15 @@ > In most scenarios, Android application installation packages can reduce size through obfuscation. > Here is a configuration method for obfuscation rules. -`KavaRef` does not require any additional configuration of obfuscation rules in Android projects. \ No newline at end of file +If you are using the [kavaref-extension](../library/kavaref-extension) module and using the `TypeRef` feature, please add the following rule to your `proguard-rules.pro` file. + +``` +-keepattributes Signature +``` + +`TypeRef` has been annotated with `Keep`. If it doesn't work, please manually add the following rules to keep the class. + +``` +-keep class com.highcapable.kavaref.extension.TypeRef {*;} +-keep class,allowobfuscation * extends com.highcapable.kavaref.extension.TypeRef +``` \ No newline at end of file diff --git a/docs-source/src/zh-cn/config/r8-proguard.md b/docs-source/src/zh-cn/config/r8-proguard.md index b24dc13..9a498ba 100644 --- a/docs-source/src/zh-cn/config/r8-proguard.md +++ b/docs-source/src/zh-cn/config/r8-proguard.md @@ -2,4 +2,15 @@ > 大部分场景下 Android 应用程序安装包可通过混淆压缩体积,这里介绍了混淆规则的配置方法。 -`KavaRef` 在 Android 项目中不需要额外配置任何混淆规则。 \ No newline at end of file +如果你使用了 [kavaref-extension](../library/kavaref-extension) 模块,并使用了其中的 `TypeRef` 功能,请在你的 `proguard-rules.pro` 文件中添加以下规则。 + +``` +-keepattributes Signature +``` + +`TypeRef` 已添加 `Keep` 注解,如果无效,请手动添加以下规则以保留类。 + +``` +-keep class com.highcapable.kavaref.extension.TypeRef {*;} +-keep class,allowobfuscation * extends com.highcapable.kavaref.extension.TypeRef +``` \ No newline at end of file