简体   繁体   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

My app was OK until recent rebuild due to adding on a few features. 由于增加了一些功能,直到最近重建之前,我的应用程序还可以。 But this added on feature is unrelated to the new error (which is weird). 但这增加的功能与新错误无关(这很奇怪)。 I even tried removing the new feature but the error still persist now. 我什至尝试删除新功能,但错误仍然存​​在。 It must have come with the new updates of Gradle or android studio. 它必须随附Gradle或android studio的新更新。

I've already checked this POJO and modified it in anyway I can, but the error still persist (or the error changes to a different variable on the same java POJO file). 我已经检查了这个POJO并以我可以的任何方式对其进行了修改,但是错误仍然存​​在(或者错误在同一Java POJO文件上更改为另一个变量)。

I've also changed the release options on build.gradle to have similar options as debug, but it's still happening. 我还更改了build.gradle的发布选项,使其具有与调试类似的选项,但这种情况仍在发生。

Based on this similar question: Firebase No properties to serialize found on class 基于以下类似问题: Firebase在类上找不到要序列化的属性

I've tried everything on there (keep class of models in proguard, the @Keep annotation on top of the said POJO model and making all variables to public on the POJO) , but to no avail. 我在那里尝试了所有方法(在proguard中保留模型的类,在所述POJO模型顶部保留@Keep注释,并将所有变量公开到POJO上),但无济于事。

This is my current build.gradle: debug { 这是我当前的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
    }

And this is the affected POJO: 这是受影响的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() {
}
}

This is the error I get now after building (both bundle and APK) as release: 这是我在构建发行版(捆绑包和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)

The error is not the same as "no properties to serialize" but I also got that error earlier when I removed proguard support. 该错误与“没有可序列化的属性”不同,但是在删除proguard支持时,我也收到了该错误。

Your variables need to be in the camelCase format, then you can do the following: 您的变量必须采用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