React Native Realm 无法在 Android 上运行(任务:realm:writeDebugAarMetadata FAILED)

问题描述 投票:0回答:1

我在我的 React Native 项目中使用 Realm。我正在 macOS 上进行开发,在 iOS 上一切都运行良好。但是,在 Android 上,我收到构建错误(见下文)。我已经用早期的提交进行了测试,其中 Realm 还没有出现,在这种情况下,一切都在 Android 上执行得很好。

No AAR for react-native-reanimated found
可以忽略,同样的问题出现在早期的提交中,并且最终一切都构建得很好。

版本:

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

控制台:

/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.
android react-native realm
1个回答
0
投票

Failed to create parent directory
,嗯,似乎是权限问题,您是否尝试移入文档文件夹?

© www.soinside.com 2019 - 2024. All rights reserved.