簡體   English   中英

構建為發行版APK后出現錯誤,但調試APK則沒有錯誤-錯誤:發現兩個吸氣劑或區分大小寫的字段

[英]Error after building as release APK but no error with debug APK - Error: Found two getters or fields with conflicting case sensitivity

由於增加了一些功能,直到最近重建之前,我的應用程序還可以。 但這增加的功能與新錯誤無關(這很奇怪)。 我什至嘗試刪除新功能,但錯誤仍然存​​在。 它必須隨附Gradle或android studio的新更新。

我已經檢查了這個POJO並以我可以的任何方式對其進行了修改,但是錯誤仍然存​​在(或者錯誤在同一Java POJO文件上更改為另一個變量)。

我還更改了build.gradle的發布選項,使其具有與調試類似的選項,但這種情況仍在發生。

基於以下類似問題: Firebase在類上找不到要序列化的屬性

我在那里嘗試了所有方法(在proguard中保留模型的類,在所述POJO模型頂部保留@Keep注釋,並將所有變量公開到POJO上),但無濟於事。

這是我當前的build.gradle:debug {

        minifyEnabled false
        useProguard false
        ext.enableCrashlytics = false
        debuggable true
        shrinkResources false
        jniDebuggable true
        renderscriptDebuggable false
        pseudoLocalesEnabled false
        zipAlignEnabled true
    }
    release {
        minifyEnabled true
        useProguard false
        debuggable false
        shrinkResources true
        jniDebuggable false
        renderscriptDebuggable false
        pseudoLocalesEnabled false
        zipAlignEnabled true
    }

這是受影響的POJO:

import android.support.annotation.Keep;
import com.google.firebase.firestore.IgnoreExtraProperties;
import com.google.firebase.Timestamp;

@IgnoreExtraProperties
@Keep
public class UIDOrg {
public String Org;
public Timestamp LastEdit;
public String RootCollection;
public Boolean UserRoleDelivery, UserRoleFulfilment, UserRoleOrder, UserRoleVerification, AllowEditOrder, AllowAddOrder;
public Long LocalNotificationReminderTime;

public Long getLocalNotificationReminderTime() {
    return LocalNotificationReminderTime;
}

public Boolean getUserRoleDelivery() {
    return UserRoleDelivery;
}

public Boolean getUserRoleFulfilment() {
    return UserRoleFulfilment;
}

public Boolean getUserRoleOrder() {
    return UserRoleOrder;
}

public Boolean getUserRoleVerification() {
    return UserRoleVerification;
}

public Boolean getAllowEditOrder() {
    return AllowEditOrder;
}

public Boolean getAllowAddOrder() { return AllowAddOrder; }

public String getOrg() {
    return Org;
}

public java.util.Date getLastEdit() {
    return LastEdit.toDate();
}

public String getRootCollection() {
    return RootCollection;
}

public UIDOrg(String org, Timestamp lastEdit, String rootCollection, Boolean userRoleDelivery, Boolean userRoleFulfilment, Boolean userRoleOrder, Boolean userRoleVerification, Boolean allowEditOrder, Boolean allowAddOrder, Long localNotificationReminderTime) {
    Org = org;
    LastEdit = lastEdit;
    RootCollection = rootCollection;
    UserRoleDelivery = userRoleDelivery;
    UserRoleFulfilment = userRoleFulfilment;
    UserRoleOrder = userRoleOrder;
    UserRoleVerification = userRoleVerification;
    AllowEditOrder = allowEditOrder;
    AllowAddOrder = allowAddOrder;
    LocalNotificationReminderTime = localNotificationReminderTime;
}

public UIDOrg() {
}
}

這是我在構建發行版(捆綁包和APK)后得到的錯誤:

java.lang.RuntimeException: Found two getters or fields with conflicting case sensitivity for property: allowaddorder
    at d.e.c.f.g.j$a.a(Unknown Source:44)
    at d.e.c.f.g.j$a.<init>(:6)
    at d.e.c.f.g.j.a(Unknown Source:12)
    at d.e.c.f.g.j.a(:16)
    at d.e.c.f.g.j.a(Unknown Source:2)
    at d.e.c.f.g.a(Unknown Source:18)
    at d.e.c.f.g.a(Unknown Source:2)
    at d.f.a.b.a.a(:1)
    at d.e.a.a.l.w.run(:6)
    at android.os.Handler.handleCallback(Handler.java:891)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:207)
    at android.app.ActivityThread.main(ActivityThread.java:7470)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

該錯誤與“沒有可序列化的屬性”不同,但是在刪除proguard支持時,我也收到了該錯誤。

您的變量必須采用camelCase格式,然后您可以執行以下操作:

public class UIDOrg {

        public String org;
        public Timestamp lastEdit;
        public String rootCollection;
        public Boolean userRoleDelivery, userRoleFulfilment, userRoleOrder, userRoleVerification, allowEditOrder, allowAddOrder;
        public Long localNotificationReminderTime;

    public UIDOrg() {
    }

    public UIDOrg(String org, Timestamp lastEdit, String rootCollection, Boolean userRoleDelivery, Boolean userRoleFulfilment, Boolean userRoleOrder, Boolean userRoleVerification, Boolean allowEditOrder, Boolean allowAddOrder, Long localNotificationReminderTime) {
        this.org = org;
        this.lastEdit = lastEdit;
        this.rootCollection = rootCollection;
        this.userRoleDelivery = userRoleDelivery;
        this.userRoleFulfilment = userRoleFulfilment;
        this.userRoleOrder = userRoleOrder;
        this.userRoleVerification = userRoleVerification;
        this.allowEditOrder = allowEditOrder;
        this.allowAddOrder = allowAddOrder;
        this.localNotificationReminderTime = localNotificationReminderTime;
    }

    public String getOrg() {
        return org;
    }

    public void setOrg(String org) {
        this.org = org;
    }

    public Timestamp getLastEdit() {
        return lastEdit;
    }

    public void setLastEdit(Timestamp lastEdit) {
        this.lastEdit = lastEdit;
    }

    public String getRootCollection() {
        return rootCollection;
    }

    public void setRootCollection(String rootCollection) {
        this.rootCollection = rootCollection;
    }

    public Boolean getUserRoleDelivery() {
        return userRoleDelivery;
    }

    public void setUserRoleDelivery(Boolean userRoleDelivery) {
        this.userRoleDelivery = userRoleDelivery;
    }

    public Boolean getUserRoleVerification() {
        return userRoleVerification;
    }

    public void setUserRoleVerification(Boolean userRoleVerification) {
        this.userRoleVerification = userRoleVerification;
    }

    public Boolean getAllowAddOrder() {
        return allowAddOrder;
    }

    public void setAllowAddOrder(Boolean allowAddOrder) {
        this.allowAddOrder = allowAddOrder;
    }

    public Long getLocalNotificationReminderTime() {
        return localNotificationReminderTime;
    }

    public void setLocalNotificationReminderTime(Long localNotificationReminderTime) {
        this.localNotificationReminderTime = localNotificationReminderTime;
    }

    public Boolean getAllowEditOrder() {
        return allowEditOrder;
    }

    public void setAllowEditOrder(Boolean allowEditOrder) {
        this.allowEditOrder = allowEditOrder;
    }

    public Boolean getUserRoleFulfilment() {
        return userRoleFulfilment;
    }

    public void setUserRoleFulfilment(Boolean userRoleFulfilment) {
        this.userRoleFulfilment = userRoleFulfilment;
    }

    public Boolean getUserRoleOrder() {
        return userRoleOrder;
    }

    public void setUserRoleOrder(Boolean userRoleOrder) {
        this.userRoleOrder = userRoleOrder;
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM