Skip to content

Android 11 Open database failed. Could not open database on some Android devices #462

@TheGameNewWorldOrder

Description

@TheGameNewWorldOrder

Hi,

Some of our users have reported an issue related to the SQLite lib. After updating their phone's OS( Color OS) to 11(Android 11), SQLite operation is broken. In debug mode I see below error:

OPEN database: StorageExtension.db failed, aborting any pending transactions
and following if trying to call any transaction:

error: openDatabase {"dblocation": "nosync", "location": "default", "name": "StorageExtension.db"} [[Error: Could not open database]]

I have verified the app and plugin work fine on Color OS 7 and 10, but broken on 11.

Expected Behavior

DB connection is as usual and DB can be opened.

Current Behavior

Opening DB failed

Possible Solution

Related to Android 11?

Steps to Reproduce (for bugs)

Example code im using:

`

SQLite.enablePromise(true);
SQLite.DEBUG(true);

const init = async () => {
await SQLite.echoTest();
db = await SQLite.openDatabase({
name: DATABASE_NAME,
location: 'default',
});
await createTables(db);
};
`

Note that this code works fine on older Color OS and other Android phone like Samsung and Huawei

Your Environment

  • React Native SQLite Storage Version used: "5.0.0"
  • React Native version used: "0.63.3"
  • Operating System and version (simulator or device): Oppo Color OS 11, Android 11
  • IDE used: Android Studio 3.5

Debug logs

image

As shown above, the db was created but at /data/data/<package_path>/databases/

I have also tried the solution to create pre-populated DB but with no luck: https://medium.com/infinitbility/react-native-sqlite-storage-422503634dd2

Any idea why this is happening? We also have users on OnePlus and Pixel reporting the same problem.

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