2
我有Firebase數據庫中存儲值的模型類,它對調試應用程序正常工作良好,但是當我以發佈模式運行或生成版本時.apk錯誤值張貼在我的Firebase數據庫中實際的json沒有發佈)。Android版本的應用程序在Firebase數據庫中插入錯誤的值
-KWqzFGEvUyCLx6obroBaddclose
a: "hLjOMC64NRdjqR0nfaUKhR3qz0l2"
b: "[email protected]"
我Proguard的條目的
-keep @com.google.gson.annotations.Expose public class *
-dontwarn sun.misc.Unsafe
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
# Facebook library
-dontwarn javax.annotation.**
-dontwarn okio.**
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.common.internal.DoNotStrip *;
}
####################Retrofit##############
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
##########################################
-keep class com.firebase.** { *; }
-keep class org.apache.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }
-dontwarn org.w3c.dom.**
-dontwarn org.joda.time.**
-dontwarn org.shaded.apache.**
-dontwarn org.ietf.jgss.**
建立警告
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(c.a.a.g.b) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
感謝您的答案,它會在正常情況下工作,但不幸的是,在發佈問題到堆棧溢出之前,我已經實現了兩個解決方案,這是我從其他線程獲得的解決方案。仍然錯誤沒有得到解決。所以我在釋放模式下啓用了調試,發現異常是在模型類本身中生成的,因爲我重寫了「equals」方法,其中生成的異常在調試模式下不會發生。暫時我補丁了錯誤,但我仍然很好奇爲什麼異常是在釋放模式下生成的。 – user2837615
@ user2837615如果您僅在發佈時遇到問題,它看起來像是一個模糊問題。但上面的第一個解決方案 - 防止對MyData進行混淆 - 應該已經解決了這個問題。也許你可以發佈equals()方法和你得到的異常堆棧? – Benoit