Skip to content

Next storage implementation: Build issues with RN 0.80.2 #1218

@rafaelaugustos

Description

@rafaelaugustos

What happened?

When using AsyncStorage with AsyncStorage_useNextStorage=true (Next Storage/Room implementation) in React Native 0.80.2 with Kotlin 2.1.20, the build fails due to KSP (Kotlin Symbol Processing) incompatibility.

Error Message:

Could not resolve all dependencies for configuration 'classpath'.
> Could not find com.google.devtools.ksp:symbol-processing-gradle-plugin:2.1.20-1.0.28

Root Cause:

KSP doesn't have a compatible version for Kotlin 2.1.20, which causes the AsyncStorage Next Storage implementation to fail during build.

Impact:

  • Build failures when using Next Storage with recent Kotlin versions
  • Forces developers to either:
    a. Disable Next Storage (causing data loss for existing users)
    b. Downgrade Kotlin (not feasible for many projects)
    c. Manually patch the library

Solution/Workaround:

Replace KSP with KAPT (Kotlin Annotation Processing Tool) for Room database compilation:

Changes needed in AsyncStorage:

  1. In android/build.gradle:
    - Remove apply plugin: 'com.google.devtools.ksp'
    - Add apply plugin: 'kotlin-kapt'
    - Change ksp "androidx.room:room-compiler:$room_version" to kapt "androidx.room:room-compiler:$room_version"
  2. Add Room dependencies to the main app's build.gradle:
  implementation "androidx.room:room-runtime:2.5.0"
  implementation "androidx.room:room-ktx:2.5.0"

Environment:

  • React Native: 0.80.2
  • AsyncStorage: 2.2.0
  • Kotlin: 2.1.20
  • Gradle: 8.14.1
  • Android Gradle Plugin: 8.1.1

Expected Behavior:

AsyncStorage Next Storage should build successfully with recent Kotlin versions.

Actual Behavior:

Build fails due to missing KSP version compatible with Kotlin 2.1.20.

Temporary Fix:

Created a patch-package patch that replaces KSP with KAPT. This allows the build to succeed while
maintaining Next Storage functionality and preserving user data.

Version

2.2.0

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
  OS: macOS 15.6.1
  CPU: (16) arm64 Apple M4 Max
  Memory: 168.52 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.6.0
    path: ~/.nvm/versions/node/v24.6.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v24.6.0/bin/yarn
  npm:
    version: 11.5.1
    path: ~/.nvm/versions/node/v24.6.0/bin/npm
  Watchman:
    version: 2025.08.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/lib/ruby/gems/3.3.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.26053.27.2432.13536105
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.15
    path: /usr/bin/javac
  Ruby:
    version: 3.3.8
    path: /opt/homebrew/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.1.1
    wanted: 19.1.1
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.2
    wanted: 0.80.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

Reproduction Steps:

  1. Create a React Native 0.80.2 project
  2. Add AsyncStorage 2.2.0
  3. Set AsyncStorage_useNextStorage=true in gradle.properties
  4. Use Kotlin 2.1.20 in your project
  5. Try to build the Android app

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