How large is AsyncStorage in React Native?

It writes to disk and is very large if there is free space. On iOS there are no artificial caps other than what the underlying operating system imposes: https://stackoverflow.com/a/1897383/454967.


On Android the limit is 6mb by default. Check this.

But you can increase that limit calling the method setMaximumSize.


The new way of increasing AsyncStorage size on react-native is to add AsyncStorage_db_size_in_MB= property to your android/gradle.properties as shown here: https://react-native-async-storage.github.io/async-storage/docs/advanced/db_size/


This is an old answer, the new method is mentioned in justin answer above..


As mentioned here, to increase the 6mb limit on Android.. try this:

in MainApplication.java add these lines in onCreate function

  public void onCreate() {
    // ...
    long size = 50L * 1024L * 1024L; // 50 MB
    com.facebook.react.modules.storage.ReactDatabaseSupplier.getInstance(getApplicationContext()).setMaximumSize(size);
  }

Tags:

React Native