簡體   English   中英

在 Android 上構建反應本機應用程序時出錯

[英]Error building react native app on Android

嗨,我正在嘗試在 android 上運行我的 react native 應用程序,但是當我構建它時,它顯示了這個錯誤:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 952 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Task :react-native-safe-area-context:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
48 actionable tasks: 2 executed, 46 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

* 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 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.

* 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 5s

    at makeError (/Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
    at /Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5)
    at async Command.handleAction (/Users/calebgarcia/Dev/Auth/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.

有點令人費解,因為當我在 ios 模擬器上構建應用程序時,它運行完美。

你們知道我該如何解決這個問題嗎?

謝謝。

npm install react-native-safe-area-context

試試這個並構建

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM