Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-2492

React Native Realm does not run on Android ( Task :realm:writeDebugAarMetadata FAILED )

      I am using Realm in my React Native project. I am developing on macOS and everything works great with iOS. However, on Android I get a build error ( see below ). I have tested with earlier commits where Realm was not yet there, everything executes well on Android in that case. No AAR for react-native-reanimated found can be ignored, the same issue appears on earlier commits and everything builds fine in the end.

      Versions:

      "react-native": "0.71.11",
      "@realm/react": "^0.5.1",
      "realm": "^11.10.1",
      Android: API 33
      

      Console:

      /usr/local/bin/node /Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/react-native/local-cli/cli.js run-android
      warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
      info JS server already running.
      info Installing the app...
      > Task :react-native-gradle-plugin:compileKotlin UP-TO-DATE
      > Task :react-native-gradle-plugin:compileJava NO-SOURCE
      > Task :react-native-gradle-plugin:pluginDescriptors UP-TO-DATE
      > Task :react-native-gradle-plugin:processResources UP-TO-DATE
      > Task :react-native-gradle-plugin:classes UP-TO-DATE
      > Task :react-native-gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
      > Task :react-native-gradle-plugin:jar UP-TO-DATE
      
      > Configure project :react-native-reanimated
      No AAR for react-native-reanimated found. Attempting to build from source.
      Android gradle plugin: 7.3.1
      Gradle: 7.5.1
      WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
      
      > Task :app:buildCodegenCLI SKIPPED
      > Task :app:generateCodegenSchemaFromJavaScript SKIPPED
      > Task :app:generateCodegenArtifactsFromSchema SKIPPED
      > Task :app:generatePackageList
      > Task :app:preBuild
      > Task :app:preDebugBuild
      > Task :react-native-device-info:preBuild UP-TO-DATE
      > Task :react-native-device-info:preDebugBuild UP-TO-DATE
      > Task :react-native-device-info:compileDebugAidl NO-SOURCE
      > Task :react-native-gesture-handler:assertNoMultipleInstances
      > Task :react-native-gesture-handler:preBuild
      > Task :react-native-gesture-handler:preDebugBuild
      > Task :react-native-reanimated:assertLatestReactNativeWithNewArchitectureTask SKIPPED
      > Task :react-native-reanimated:assertNoMultipleInstances
      > Task :react-native-reanimated:assertNoReanimated2WithNewArchitectureTask SKIPPED
      > Task :react-native-reanimated:preBuild
      > Task :react-native-reanimated:preDebugBuild
      > Task :react-native-reanimated:compileDebugAidl NO-SOURCE
      > Task :react-native-gesture-handler:compileDebugAidl NO-SOURCE
      > Task :react-native-safe-area-context:preBuild UP-TO-DATE
      > Task :react-native-safe-area-context:preDebugBuild UP-TO-DATE
      > Task :react-native-safe-area-context:compileDebugAidl NO-SOURCE
      > Task :react-native-screens:preBuild UP-TO-DATE
      > Task :react-native-screens:preDebugBuild UP-TO-DATE
      > Task :react-native-screens:compileDebugAidl NO-SOURCE
      > Task :react-native-svg:preBuild UP-TO-DATE
      > Task :react-native-svg:preDebugBuild UP-TO-DATE
      > Task :react-native-svg:compileDebugAidl NO-SOURCE
      > Task :react-native-vector-icons:preBuild UP-TO-DATE
      > Task :react-native-vector-icons:preDebugBuild UP-TO-DATE
      > Task :react-native-vector-icons:compileDebugAidl NO-SOURCE
      > Task :realm:preBuild UP-TO-DATE
      > Task :realm:preDebugBuild UP-TO-DATE
      > Task :realm:compileDebugAidl NO-SOURCE
      > Task :app:compileDebugAidl NO-SOURCE
      > Task :react-native-device-info:packageDebugRenderscript NO-SOURCE
      > Task :react-native-gesture-handler:packageDebugRenderscript NO-SOURCE
      > Task :react-native-reanimated:packageDebugRenderscript NO-SOURCE
      > Task :react-native-safe-area-context:packageDebugRenderscript NO-SOURCE
      > Task :react-native-screens:packageDebugRenderscript NO-SOURCE
      > Task :react-native-svg:packageDebugRenderscript NO-SOURCE
      > Task :react-native-vector-icons:packageDebugRenderscript NO-SOURCE
      > Task :realm:packageDebugRenderscript NO-SOURCE
      > Task :app:compileDebugRenderscript NO-SOURCE
      > Task :app:generateDebugBuildConfig UP-TO-DATE
      > Task :app:javaPreCompileDebug UP-TO-DATE
      > Task :react-native-device-info:writeDebugAarMetadata UP-TO-DATE
      > Task :react-native-gesture-handler:writeDebugAarMetadata UP-TO-DATE
      > Task :react-native-reanimated:writeDebugAarMetadata UP-TO-DATE
      > Task :react-native-safe-area-context:writeDebugAarMetadata UP-TO-DATE
      > Task :react-native-screens:writeDebugAarMetadata UP-TO-DATE
      > Task :react-native-svg:writeDebugAarMetadata UP-TO-DATE
      > Task :react-native-vector-icons:writeDebugAarMetadata UP-TO-DATE
      > Task :realm:writeDebugAarMetadata FAILED
      18 actionable tasks: 4 executed, 14 up-to-date
      
      FAILURE: Build completed with 2 failures.
      
      1: Task failed with an exception.
      -----------
      * What went wrong:
      Execution failed for task ':realm:writeDebugAarMetadata'.
      > Failed to create parent directory '/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/realm/react-native/android/build' when creating directory '/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/realm/react-native/android/build/intermediates/aar_metadata/debug'
      
      * Try:
      > Run with --stacktrace option to get the stack trace.
      > Run with --info or --debug option to get more log output.
      > Run with --scan to get full insights.
      ==============================================================================
      
      2: Task failed with an exception.
      -----------
      * What went wrong:
      java.lang.StackOverflowError (no error message)
      
      * Try:
      > Run with --stacktrace option to get the stack trace.
      > Run with --info or --debug option to get more log output.
      > Run with --scan to get full insights.
      ==============================================================================
      
      * Get more help at https://help.gradle.org
      
      BUILD FAILED in 6s
      
      Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
      
      FAILURE: Build completed with 2 failures.
      
      1: Task failed with an exception.
      -----------
      * What went wrong:
      Execution failed for task ':realm:writeDebugAarMetadata'.
      > Failed to create parent directory '/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/realm/react-native/android/build' when creating directory '/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/realm/react-native/android/build/intermediates/aar_metadata/debug'
      
      * Try:
      > Run with --stacktrace option to get the stack trace.
      > Run with --info or --debug option to get more log output.
      > Run with --scan to get full insights.
      ==============================================================================
      
      2: Task failed with an exception.
      -----------
      * What went wrong:
      java.lang.StackOverflowError (no error message)
      
      * Try:
      > Run with --stacktrace option to get the stack trace.
      > Run with --info or --debug option to get more log output.
      > Run with --scan to get full insights.
      ==============================================================================
      
      * Get more help at https://help.gradle.org
      
      BUILD FAILED in 6s
      
          at makeError (/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
          at /Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
          at async runOnAllDevices (/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
          at async Command.handleAction (/Users/admin/dev_directory/smartphone-app/SmartphoneApp/node_modules/@react-native-community/cli/build/index.js:108:9)
      info Run CLI with --verbose flag for more details.
      error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: