Ошибка после сборки как выпускающего APK, но нет ошибки с отладочным APK - ошибка: найдено два получателя или поля с конфликтующей чувствительностью к регистру - PullRequest
0 голосов
/ 09 июня 2019

Мое приложение было в порядке до недавней перестройки из-за добавления нескольких функций.Но эта добавленная функция не связана с новой ошибкой (что странно).Я даже попытался удалить новую функцию, но ошибка все еще сохраняется.Должно быть, он пришел с новыми обновлениями Gradle или Android Studio.

Я уже проверил этот POJO и изменил его в любом случае я могу, но ошибка все еще сохраняется (или ошибка меняется на другую переменную втот же файл Java POJO).

Я также изменил параметры выпуска на build.gradle, чтобы иметь такие же параметры, как отладка, но это все еще происходит.

На основании этого похожего вопроса: Firebase Нет свойств для сериализациинайдено в классе

Я там все перепробовал (держите класс моделей в proguard, аннотацию @Keep поверх указанной модели POJO и сделайте все переменные общедоступными в 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() {
}
}

Это ошибка Iполучить сейчас после сборки (как bundle, так и 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.

1 Ответ

1 голос
/ 09 июня 2019

Ваши переменные должны быть в формате 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;
    }
}
...