当我使用 minifyEnabled 应用时总是崩溃

when i use minifyEnabled app keep crashing

最近我开发了一个 android 应用程序。 一切顺利,但是当我使用 "minifyEnabled true" 应用时,应用程序不断崩溃并出现此错误:

com.google.gson.internal.LinkedTreeMap
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1344)
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:959)
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360)
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054)
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:959)
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360)
java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054)
java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
org.matrix.androidsdk.data.cryptostore.db.HelperKt.serializeForRealm(:102)
org.matrix.androidsdk.data.cryptostore.db.model.DeviceInfoEntity.putDeviceInfo(:43)
org.matrix.androidsdk.data.cryptostore.db.RealmCryptoStore$storeUserDevices.invoke(:244)
org.matrix.androidsdk.data.cryptostore.db.RealmCryptoStore$storeUserDevices.invoke(:44)
org.matrix.androidsdk.data.cryptostore.db.HelperKt$doRealmTransaction.execute(:86)
io.realm.Realm.a(:1493)
org.matrix.androidsdk.data.cryptostore.db.HelperKt.doRealmTransaction(:86)
org.matrix.androidsdk.data.cryptostore.db.RealmCryptoStore.storeUserDevices(:228)
org.matrix.androidsdk.crypto.MXDeviceList.run(:605)
android.os.Handler.handleCallback(Handler.java:815)
android.os.Handler.dispatchMessage(Handler.java:104)
android.os.Looper.loop(Looper.java:227)
android.os.HandlerThread.run(HandlerThread.java:61)

我尝试了对 proguard 配置文件的许多更改,但问题仍然存在

Proguard 似乎无法正确处理 LinkedTreeMap。尝试添加一条规则以跳过这个 class 到位于应用程序文件夹

内的 proguard-rules.pro 文件
-keep class [full class name] { *; }