You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* added delivery of ProGuard/R8 rules along with the core artifact.
* the documentation about the rules has been made more readable
* added an example of rules for named companions for R8 full mode
* added R8-only rules to support full mode
* rules have been introduced suppressing some warnings about serialization classes
Resolves#1121Resolves#1899Resolves#1900Resolves#2050
-keepnames class <1>$$serializer { # -keepnames suffices; class is kept when serializer() is kept.
227
+
static <1>$$serializer INSTANCE;
260
228
}
261
229
262
-
# Serialization supports named companions but for such classes it is necessary to add an additional rule.
263
-
# This rule keeps serializer and serializable class from obfuscation. Therefore, it is recommended not to use wildcards in it, but to write rules for each such class.
264
-
-keepattributes InnerClasses # Needed for `getDeclaredClasses`.
265
-
-keep class com.yourcompany.yourpackage.SerializableClassWithNamedCompanion$$serializer {
266
-
*** INSTANCE;
230
+
# Keep both serializer and serializable classes to save the attribute InnerClasses
231
+
-keepclasseswithmembers, allowshrinking, allowobfuscation, allowaccessmodification class
232
+
com.example.myapplication.HasNamedCompanion, # <-- List serializable classes with named companions.
233
+
com.example.myapplication.HasNamedCompanion2
234
+
{
235
+
*;
267
236
}
268
237
```
269
238
</details>
270
239
240
+
In case you want to exclude serializable classes that are used, but never serialized at runtime,
241
+
you will need to write custom rules with narrower [class specifications](https://www.guardsquare.com/manual/configuration/usage).
242
+
271
243
### Multiplatform (Common, JS, Native)
272
244
273
245
Most of the modules are also available for Kotlin/JS and Kotlin/Native.
# Don't print notes about potential mistakes or omissions in the configuration for kotlinx-serialization classes
29
+
# See also https://github.com/Kotlin/kotlinx.serialization/issues/1900
30
+
-dontnote kotlinx.serialization.**
31
+
32
+
# Serialization core uses `Class.forName("java.lang.ClassValue")` for caching in JVM-only, so it is an expected situation that this class is not in Android
0 commit comments