由于 avd 太慢,我如何 运行 在我的手机中使用 react-native 应用程序

How Can I run react-native app in my mobile because avd is too slow

请帮帮我。我的 React Native 应用程序不在我的手机中 运行。它在 android 模拟器上运行良好,但性能很差。

错误是:

$ react-native run-android
  info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" 
  flag.
  Jetifier found 967 file(s) to forward-jetify. Using 2 workers...
  info Starting JS server...
  info Installing the app...

  FAILURE: Build failed with an exception.

  * What went wrong:
  Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

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

  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: Com

  mand failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

尝试React Native environment to upgrade your environment because there is a thread in here

很简单,只需将您的手机连接到 Android studio 并打开开发模式,然后 select 来自 Android studio 的设备和 运行 应用程序的项目将简单地打开你的 phone ,除非你在环境中没有任何错误。

这可能是因为 Jdk 的版本较低。请更新 JDK 受 Android Studio

支持的版本

供参考: