问题:
java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/com.example.mynote/files/datastore/setting.preferences_pb. You should either maintain your DataStore as a singleton or confirm that there is no two DataStore's active on the same file (by confirming that the scope is cancelled).
解决:
在
dataStore = new RxPreferenceDataStoreBuilder(getContext(), "setting").build();
的同代码块最后添加
dataStore.dispose();