快速序列化 android 工作室 gradle 错误

fast-serialization android studio gradle error

我正在为我的移动应用程序使用 this 库,但是当我尝试创建一个启用了 ProGuard 的签名 APK(发布配置)时,它给了我数千个这样的错误:

Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.AttachingConnector
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.Connector$Argument
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.AttachingConnector
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.VirtualMachine
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.Bootstrap
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.VirtualMachineManager
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.connect.Connector
Warning:javassist.util.HotSwapper: can't find referenced class com.sun.jdi.request.EventRequestManager

我尝试了以下混淆器规则

-dontwarn com.**
-dontwarn sun.**
-dontwarn java.**
-keep class com.** { *; }
-keep class sun.** { *; }
-keep class java.** { *; }

但这只会导致我签名的 APK 永远生成并且永远不会完成。我忘记配置了什么?

我已经使用以下 proguard 规则修复了它

-dontwarn com.**
-dontwarn sun.**
-dontwarn java.**
-keep class com.** { *; }
-keep class sun.** { *; }
-keep class java.** { *; }
-keepclassmembers class sun.** { *; }
-keepclassmembers class java.** { *; }
-keepclassmembers class com.** { *; }

尽管我不明白为什么我需要 -keepclassmembers 才能完成 gradle 构建。