Skip to content

[Android] IllegalStateException: Multiple DataStores active after upgrading to v10.0.0 #777

@nidhi-jnctn

Description

@nidhi-jnctn

After upgrading react-native-keychain from v8.2.0 directly to v10.0.0, the app builds successfully but crashes on Android when trying to run the app with the following error::

java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/<package>/files/datastore/RN_KEYCHAIN.preferences_pb. You should either maintain your DataStore as a singleton or confirm that there is no two DataStores active on the same file (by confirming that the scope is cancelled).

This happens when using any KeychainModule methods that read or write secure credentials.

To Reproduce

  • Upgrade react-native-keychain from v8.2.0 to v10.0.0.
  • Run the app on Android.
  • Call Keychain.setInternetCredentials() or Keychain.getInternetCredentials().
  • Observe the above exception being thrown

Environment:

  • react-native-keychain version: 10.0.0
  • React Native version: 0.77.1 (old architecture)
  • Android API Level: 35.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions