Coder Social home page Coder Social logo

Comments (3)

yomigatz avatar yomigatz commented on June 11, 2024

大概率时混淆的问题导致,库应该在Android上“原样”工作。如果使用的是proguard,则需要将此添加到proguard-rules.pro:
-keepattributes *Annotation*, InnerClasses -dontnote kotlinx.serialization.SerializationKt -keep,includedescriptorclasses class com.yourcompany.yourpackage.**$$serializer { *; } # <-- change package name to your app's -keepclassmembers class com.yourcompany.yourpackage.** { # <-- change package name to your app's *** Companion; } -keepclasseswithmembers class com.yourcompany.yourpackage.** { # <-- change package name to your app's kotlinx.serialization.KSerializer serializer(...); }

或者将数据模型添加到忽略文件中:
-keep class com.xx.xxx.xx.data.model.** { *; } -keep class com.xx.xxx.xx.data.bean.** { *; }

from net.

yomigatz avatar yomigatz commented on June 11, 2024

因为我是在lib中配置的项目,所以混淆需要在build.gradle中配置
consumerProguardFiles "consumer-rules.pro"
然后将混淆规则配置到consumer-rules.pro文件中,
至此,我的问题解决了。

from net.

liangjingkanji avatar liangjingkanji commented on June 11, 2024

因为序列化框架使用注解的问题

或者建议你还有Jackson取代kotlin-serialization, 他是使用反射反序列化Json

from net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.