Skip to content

AsyncStorage native module not built/included on Android with React Native 0.73.x (no errors, module is null at runtime) #1208

Open
@StumpyFrostreaver

Description

@StumpyFrostreaver

What happened?

Description

When using @react-native-async-storage/async-storage (tested 2.2.0 and 2.1.0) with React Native 0.73.9 on Android, the native module is not built or included in the APK. There are no build errors, but at runtime, NativeModule: AsyncStorage is null is thrown and the native library is missing from the build output.

React Native version

0.73.9

AsyncStorage version

Tested 2.2.0 and 2.1.0

Environment

  • Android Studio Cloud (ASC) environment (but also fails locally)
  • Node version: [your node version]
  • npm version: [your npm version]
  • Kotlin version: 1.9.24 (set in gradle.properties and build.gradle)
  • Room version: 2.6.1 (set in gradle.properties)
  • KSP version: 1.9.24-1.0.20 (set in gradle.properties)

Steps to reproduce

  1. Create a new RN project:
    npx @react-native-community/cli init AsyncStorageTest --version 0.73.9
  2. cd AsyncStorageTest
  3. npm install @react-native-async-storage/async-storage
  4. Add to android/gradle.properties:
    AsyncStorage_useNextStorage=true
    AsyncStorage_kotlinVersion=1.9.24
    AsyncStorage_next_roomVersion=2.6.1
    AsyncStorage_next_kspVersion=1.9.24-1.0.20
    
  5. Update android/build.gradle to use Kotlin 1.9.24.
  6. npx react-native run-android
  7. Check android/app/build/intermediates/merged_native_libs/debug/out/lib/x86_64 — no native library for AsyncStorage is present.

Expected behavior

AsyncStorage native library should be built and included in the APK, and the module should be available at runtime.

Actual behavior

  • Build is “successful,” but no native library for AsyncStorage is present.
  • At runtime: NativeModule: AsyncStorage is null
  • No errors or warnings in the build log related to AsyncStorage.

Reproducible demo

Steps above reproduce the issue in a fresh project.

Additional context

  • Tried both 2.2.0 and 2.1.0.
  • Tried all recommended gradle flags and versions.
  • No manual linking or react-native.config.js.
  • Issue persists in both main project and fresh minimal project.

Version

2.2.0 (also tested 2.1.0)

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

info Fetching system and libraries information...
System:
  OS: Linux 6.6 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
  CPU: (16) x64 Intel(R) Xeon(R) CPU @ 2.20GHz
  Memory: 41.66 GB / 58.86 GB
  Shell:
    version: 5.2.21
    path: /bin/bash
Binaries:
  Node:
    version: 20.19.2
    path: /usr/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.15
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

info React Native v0.80.0 is now available (your project is running on v0.73.9).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.80.0
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.80.0
info For more info, check out "https://reactnative.dev/docs/upgrading?os=linux".

Steps to Reproduce

  1. Create a new RN project:
    npx @react-native-community/cli init AsyncStorageTest --version 0.73.9
  2. cd AsyncStorageTest
  3. npm install @react-native-async-storage/async-storage
  4. Add to android/gradle.properties:
    AsyncStorage_useNextStorage=true
    AsyncStorage_kotlinVersion=1.9.24
    AsyncStorage_next_roomVersion=2.6.1
    AsyncStorage_next_kspVersion=1.9.24-1.0.20
    
  5. Update android/build.gradle to use Kotlin 1.9.24:
    buildscript {
        ext {
            kotlinVersion = project.hasProperty('kotlinVersion') ? project.getProperty('kotlinVersion') : "1.9.24"
            // ...other versions
        }
        dependencies {
            classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
            // ...other dependencies
        }
    }
  6. npx react-native run-android
  7. Check android/app/build/intermediates/merged_native_libs/debug/out/lib/x86_64 — no native library for AsyncStorage is present.

Expected:
AsyncStorage native library should be built and included in the APK, and the module should be available at runtime.

Actual:

  • Build is “successful,” but no native library for AsyncStorage is present.
  • At runtime: NativeModule: AsyncStorage is null
  • No errors or warnings in the build log related to AsyncStorage.

Environment:

  • Node: v20.19.2
  • npm: 10.8.2
  • Kotlin: 1.9.24
  • Room: 2.6.1
  • KSP: 1.9.24-1.0.20
  • Android Studio Cloud (ASC) environment (but also fails locally)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions