简体   繁体   English

React Native 无法在 Android 设备中运行

[英]React Native won't run in Android device

I just started to learn React Native.我刚开始学习 React Native。 I was trying to run my react-native-cli apps to my phone it already install to my phone but it won't run.我试图在我的手机上运行我的 react-native-cli 应用程序,它已经安装到我的手机上,但它不会运行。 Here's the details:这是详细信息:

  1. I'm using Xiaomi Redmi 4x我用的是小米红米4x
  2. USB Debugging on USB 调试开启
  3. Install via USB on通过 USB 安装
  4. USB Debugging(Security Setting) on USB 调试(安全设置)开启
  5. Verify apps over USB on通过 USB 验证应用程序
  6. Turn on MIUI optimization has been disabled开启MIUI优化已禁用

When I execute react-native run-android it run well, and the app is installed in my device but the app won't run in my device and I got this error in terminal当我执行react-native run-android时,它运行良好,应用程序安装在我的设备中,但应用程序无法在我的设备中运行,我在终端中收到此错误

BUILD SUCCESSFUL in 54s
27 actionable tasks: 2 executed, 25 up-to-date
info Connecting to the development server...
debug Running command "C:\Users\Handa-Kun\AppData\Local\Android\Sdk;C:\Users\Handa-Kun\AppData\Local\Android\Sdk\platform-tools;/platform-tools/adb reverse tcp:8081 tcp:8081"
warn Failed to connect to development server using "adb reverse": spawnSync C:\Users\Handa-Kun\AppData\Local\Android\Sdk;C:\Users\Handa-Kun\AppData\Local\Android\Sdk\platform-tools;/platform-tools/adb ENOENT
info Starting the app...
debug Running command "C:\Users\Handa-Kun\AppData\Local\Android\Sdk;C:\Users\Handa-Kun\AppData\Local\Android\Sdk\platform-tools;/platform-tools/adb shell
am start -n com.appkedua/com.appkedua.MainActivity"
The filename, directory name, or volume label syntax is incorrect.
error Failed to start the app.
Error: Command failed: C:\Users\Handa-Kun\AppData\Local\Android\Sdk;C:\Users\Handa-Kun\AppData\Local\Android\Sdk\platform-tools;/platform-tools/adb shell
am start -n com.appkedua/com.appkedua.MainActivity
    at makeError (F:\react-native\AppKedua\node_modules\execa\index.js:174:9)

I've been lurking in Stack Overflow and Google but I couldn't find the answer.我一直潜伏在 Stack Overflow 和 Google 中,但找不到答案。

it seems problem with your ANDROID HOME path, you can try this你的 ANDROID HOME 路径似乎有问题,你可以试试这个

execute following commmand执行以下命令

set ANDROID_HOME=c:/Users/whoever/AppData/Local/Android/Sdk

for detail explanation please go to React Native adb reverse ENOENT有关详细说明,请 go 到React Native adb reverse ENOENT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM