如何修复Firestore无法在手机上更新(AndroidStudio APK部署)

时间:2018-11-21 00:37:06

标签: android google-cloud-firestore persistence avd

错误是:

D/ShopsCollectionDisplaye: FromDBToShopsCollection: Doc{id=shop_test_Fb_1, shopImg=2131165326} D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.tacaalacaraman.wortheat, PID: 10527 java.lang.RuntimeException: Could not deserialize object. Failed to convert value of type java.lang.Long to String (found in field 'shopImg')

现在,我的应用使用字符串,程序也使用字符串,但是我的Android设备无法更新代码或类似的内容

1 个答案:

答案 0 :(得分:0)

最后是因为Firestore在缓存(持久性)中使用了db。所以我不得不用FirebaseFirestoreSettings禁用Persistance:

private FirebaseFirestore db = FirebaseFirestore.getInstance();
private FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
        .setPersistenceEnabled(false)
        .build();

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    ....
    db.setFirestoreSettings(settings);
    ....
相关问题