如何修复 Firestore 未在我的 Phone 上更新(AndroidStudio apk 部署)
How do I fix Firestore not updating on my Phone (AndroidStudio apk deployment)
错误是:
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 设备不更新代码或类似的东西
最后是因为 Firestore 在缓存中使用数据库(持久性)。所以我不得不用 FirebaseFirestoreSettings
:
禁用持久性
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);
....
错误是:
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 设备不更新代码或类似的东西
最后是因为 Firestore 在缓存中使用数据库(持久性)。所以我不得不用 FirebaseFirestoreSettings
:
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);
....