Kotlin / kotlinx.serialization

Kotlin multiplatform / multi-format serialization
Apache License 2.0
5.23k stars 615 forks source link

java.lang.ClassNotFoundException: Didn't find class "kotlinx.serialization.json.Json" on path: DexPathLis #2688

Open msalamaCS opened 1 month ago

msalamaCS commented 1 month ago

When dexguarding the APK and running Kotlin from JSON to data serialization, I'm getting this crash exception: java.lang.ClassNotFoundException: Didn't find class "kotlinx.serialization.json.Json" on path: DexPathList. However, it is working fine in debug mode.

I tried to include all Kotlin serialization classes, but I'm still getting the exception.

`java.lang.NoClassDefFoundError: Failed resolution of: Lkotlinx/serialization/json/Json;

Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlinx.serialization.json.Json" on path: DexPathList`

Attach a code snippet or test data if possible.

Expected behavior

Environment

sandwwraith commented 1 month ago

Not sure what can be the case, since Json is a regular class and should be processed just as any other usual class. Maybe -keep class kotlinx.serialization.json.** { *; } would help? If possible, please attach your project here or in another github repo because it is hard to say what happened without a reproducer.