Cloud Firebase对SugarRecord的致命异常

时间:2018-12-17 21:37:35

标签: android google-cloud-firestore sugarrecord

在我的 Android 项目中,我正在使用 SugarRecord 在本地存储 Cloud Firestore 的集合。

运行代码时,出现以下致命异常。我不知道为什么它要尝试编译df = df.orderBy(["prod", "rank"], ascending=[1, 1]) df = df.rdd.map(lambda r: (r.prod, r.value)).reduceByKey(lambda x,y: list(x) + list(y)).toDF(['prod','conc']) df.show() +----+------------+ |prod| conc| +----+------------+ | 9|[A, B, C, D]| | 10| [A, B]| +----+------------+

此SQL代码来自哪里?我还没写。

如何解决此错误?我已经关注了3个星期。

Store.java

INSERT OR REPLACE  INTO STORE(TOTAL_TEXT,ADDRESS,MAIL,TOTAL_XPOINT,PHONE,CURRENCY,CITY,OWNER,DATE_FORMAT,ID,NAME,PRICE_SEPARATOR,POSTAL_CODE,TAX_CODE,STORE_ID,COUNTRY) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

FirebaseDatabaseHelper.java

public class Store extends SugarRecord
{
    @Unique
    private String storeId;
    private String address;
    private String city;
    private String country;
    private String mail;
    private String phone;
    private String postalCode;
    private String taxCode;
    private String name;
    private float totalXpoint;
    private String priceSeparator;
    private String totalText;
    private String dateFormat;
    private String currency;

    public Store()
    {
        super();
    }

    public String getOwner()
    {
        return owner;
    }

    public void setOwner(String owner)
    {
        this.owner = owner;
    }

    private String owner;


    public String getStoreId()
    {
        return storeId;
    }

    public void setStoreId(String storeId)
    {
        this.storeId = storeId;
    }

    public String getAddress()
    {
        return address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    public String getCity()
    {
        return city;
    }

    public void setCity(String city)
    {
        this.city = city;
    }

    public String getCountry()
    {
        return country;
    }

    public void setCountry(String country)
    {
        this.country = country;
    }

    public String getMail()
    {
        return mail;
    }

    public void setMail(String mail)
    {
        this.mail = mail;
    }

    public String getPhone()
    {
        return phone;
    }

    public void setPhone(String phone)
    {
        this.phone = phone;
    }

    public String getPostalCode()
    {
        return postalCode;
    }

    public void setPostalCode(String postalCode)
    {
        this.postalCode = postalCode;
    }

    public String getTaxCode()
    {
        return taxCode;
    }

    public void setTaxCode(String taxCode)
    {
        this.taxCode = taxCode;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public float getTotalXpoint()
    {
        return totalXpoint;
    }

    public void setTotalXpoint(float totalXpoint)
    {
        this.totalXpoint = totalXpoint;
    }

    public String getPriceSeparator()
    {
        return priceSeparator;
    }

    public void setPriceSeparator(String priceSeparator)
    {
        this.priceSeparator = priceSeparator;
    }

    public String getTotalText()
    {
        return totalText;
    }

    public void setTotalText(String totalText)
    {
        this.totalText = totalText;
    }

    public String getDateFormat()
    {
        return dateFormat;
    }

    public void setDateFormat(String dateFormat)
    {
        this.dateFormat = dateFormat;
    }

    public String getCurrency()
    {
        return currency;
    }

    public void setCurrency(String currency)
    {
        this.currency = currency;
    }

    @Override
    public String toString()
    {
        return "Store{" +
                "storeId='" + storeId + '\'' +
                ", address='" + address + '\'' +
                ", city='" + city + '\'' +
                ", country='" + country + '\'' +
                ", mail='" + mail + '\'' +
                ", phone='" + phone + '\'' +
                ", postalCode='" + postalCode + '\'' +
                ", taxCode='" + taxCode + '\'' +
                ", name='" + name + '\'' +
                ", totalXpoint=" + totalXpoint +
                ", priceSeparator='" + priceSeparator + '\'' +
                ", totalText='" + totalText + '\'' +
                ", dateFormat='" + dateFormat + '\'' +
                ", currency='" + currency + '\'' +
                '}';
    }
}

Logcat

public static void getAllStores(final StoresSyncedListener storesSyncedListener)
    {
        FirebaseFirestore db = FirebaseFirestore.getInstance();
        log("getAllStores");
        db.collection("Stores")
                .get()
                .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>()
                {
                    @Override
                    public void onComplete(@NonNull Task<QuerySnapshot> task)
                    {
                        log("task.toString " + task.toString());
                        log("task.isSuccessful " + task.isSuccessful());
                        if (task.isSuccessful())
                        {
                            log("task.getResult " + task.getResult().size());
                            for (QueryDocumentSnapshot document : task.getResult())
                            {
                                Store store = document.toObject(Store.class);
                                store.setStoreId(document.getId());
                                //save all stores to local Sugar database
                                SugarRecord.save(store);
                            }
                            log("task.SugarRecord.saveInTx B");

                            storesSyncedListener.onStoresSynced(true);
                        }
                        else
                        {
                            storesSyncedListener.onStoresSynced(false);
                            logError("Error getting documents: ", task.getException());
                        }
                    }
                });
    }

0 个答案:

没有答案