【发布时间】:2019-12-15 11:57:03
【问题描述】:
这个实体正确地使用 Firebase RealmDataBase,但是当我添加时
minifyEnabled true
在构建的 gradle 中,我得到了这个 ->
DatabaseException: Found two getters or fields with conflicting case sensitivity for property: sName
附言如果我更改给我此异常的字段的名称,那么这些名称将保存在服务器上,我认为问题始于字段的注释
它是我的实体
@IgnoreExtraProperties
data class Account(
@get:PropertyName(ACCOUNT_NAME) @set:PropertyName(ACCOUNT_NAME) var name: String,
@get:PropertyName(ACCOUNT_SNAME) @set:PropertyName(ACCOUNT_SNAME) var sName: String,
@get:PropertyName(ACCOUNT_CITY) @set:PropertyName(ACCOUNT_CITY) var city: String,
@get:PropertyName(ACCOUNT_GYM) @set:PropertyName(ACCOUNT_GYM) var gym: String,
@get:PropertyName(ACCOUNT_WEIGHT) @set:PropertyName(ACCOUNT_WEIGHT) var weight: String,
@get:PropertyName(ACCOUNT_HEIGHT) @set:PropertyName(ACCOUNT_HEIGHT) var height: String,
@get:PropertyName(ACCOUNT_URI_PICTURE) @set:PropertyName(ACCOUNT_URI_PICTURE) var imageUrl: String,
@Exclude @set:Exclude @get:Exclude var followers: List<String> = emptyList(),
@Exclude @set:Exclude @get:Exclude var subscribers: List<String> = emptyList(),
@Exclude @set:Exclude @get:Exclude var countAchievements: List<String> = emptyList()
) : AccountListGrouper, Parcelable {
@Exclude
override fun getItemType() = TYPE_ACCOUNT
constructor(source: Parcel) : this(
source.readString() ?: "",
source.readString() ?: "",
source.readString() ?: "",
source.readString() ?: "",
source.readString() ?: "",
source.readString() ?: "",
source.readString() ?: ""
)
@Exclude
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(name)
dest.writeString(sName)
dest.writeString(city)
dest.writeString(gym)
dest.writeString(weight)
dest.writeString(height)
dest.writeString(imageUrl)
}
constructor() : this("", "", "", "", "", "", "")
@Exclude
override fun describeContents() = 0
companion object {
@JvmField
val CREATOR: Parcelable.Creator<Account> = object : Parcelable.Creator<Account> {
override fun createFromParcel(source: Parcel): Account = Account(source)
override fun newArray(size: Int): Array<Account?> = arrayOfNulls(size)
}
}
}
这是我尝试添加到 proguard-rules.pro 的全部内容
-keep class com.voitenko.dev.training_booster.** { *; }
-keep class com.sdsmdg.harjot.** { *; }
#Firebase
-keepattributes Signature
-keepclassmembers class com.voitenko.dev.training_booster.models** { *;}
-keepnames class com.voitenko.dev.training_booster.** { *; }
-keepattributes *Annotation*
-keep class com.google.firebase.** { *; }
#_____________
# Needed for DNS resolution. Present in OpenJDK, but not Android
-dontwarn javax.naming.**
# Don't warn about checkerframework
#
# Guava uses the checkerframework and the annotations
# can safely be ignored at runtime.
-dontwarn org.checkerframework.**
# Guava warnings:
-dontwarn java.lang.ClassValue
-dontwarn com.google.j2objc.annotations.Weak
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn javax.lang.model.element.Modifier
# Okhttp warnings.
-dontwarn okio.**
-dontwarn com.google.j2objc.annotations.**
【问题讨论】:
标签: exception kotlin firebase-realtime-database proguard