React Native 运行 - Android 产生奇怪的错误

React Native run - Android producing strange error

我想问一下下面的错误。所以我在一年前开发了一个小型 BLE 应用程序并成功地实现了它。我没有将它推送到 Google Play 商店,而是通过 USB 以某种方式将它安装在 Android 上。

但是,现在我需要恢复它,运行但是我面临着大量的错误。

PS C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard> npx react-native run-android 
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1302 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...

> Configure project :app

Installing unimodules:
 unimodules-core@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\@unimodules\core
 unimodules-react-native-adapter@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\@unimodules\react-native-adapter
 expo-app-loader-provider@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-app-loader-provider
 expo-constants@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-constants
 expo-error-recovery@1.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-error-recovery
 expo-file-system@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-file-system
 expo-font@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-font
 expo-keep-awake@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-keep-awake
 expo-linear-gradient@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-linear-gradient
 expo-location@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-location
 expo-permissions@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-permissions
 expo-sqlite@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-sqlite
 expo-web-browser@8.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\expo-web-browser
 unimodules-barcode-scanner-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-barcode-scanner-interface
 unimodules-camera-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-camera-interface
 unimodules-constants-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-constants-interface
 unimodules-face-detector-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-face-detector-interface
 unimodules-file-system-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-file-system-interface
 unimodules-font-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-font-interface
 unimodules-image-loader-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-image-loader-interface
 unimodules-permissions-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-permissions-interface
 unimodules-sensors-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-sensors-interface
 unimodules-task-manager-interface@5.0.0 from C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard\node_modules\unimodules-task-manager-interface

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.
If the parent project does not need the plugin, add 'apply false' to the plugin line.
See: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl
The Kotlin plugin was loaded in the following projects: ':expo-error-recovery', ':expo-permissions'

> Task :@react-native-community_async-storage:compileDebugJavaWithJavac FAILED

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

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':@react-native-community_async-storage:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that C:\Program Files (x86)\Java\jre1.8.0_251 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 31s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

PS C:\Users\stefanec\Desktop\SOC\i_garden\i_garden\iGard>

您似乎没有安装 JDK。

如果您使用的是 Mac 或按照文档了解如何在您的特定机器上安装,请使用下面的命令使用 brew 安装它

brew install --cask adoptopenjdk/openjdk/adoptopenjdk8

按照此 guide 安装 windows

查看文档 https://reactnative.dev/docs/_getting-started-macos-android#installing-dependencies