简体   繁体   English

在React中,“adb”不会被识别为内部和外部命令

[英]In React native 'adb' is not recognized as an internal and external command

I tried to set the path in environmental variables but it doesn't work. 我试图在环境变量中设置路径,但它不起作用。

Error like as below: 'adb' is not recognized as an internal or external command, operable program or batch file.Starting the app (C:\\Users\\Administrator\\AppData\\Local\\Android\\Sdk/platform-tool s/adb shell am start -n com.demo/com.demo.MainActivity... Starting: Intent { cmp=com.demo/.MainActivity } 错误如下所示:'adb'未被识别为内部或外部命令,可操作程序或批处理文件。启动应用程序(C:\\ Users \\ Administrator \\ AppData \\ Local \\ Android \\ Sdk / platform-tool s / adb shell我开始-n com.demo / com.demo.MainActivity ...开始:Intent {cmp = com.demo / .MainActivity}

First of all you have to set environment variable of your android sdk's platform-tool 首先,你必须设置你的android sdk平台工具的环境变量

Start > Control Panel > System > Advanced System Settings > Environment Variables... 开始>控制面板>系统>高级系统设置>环境变量...

In this Environment Variables window, in the User variables section for (your-username) highlight Path and click Edit... 在此环境变量窗口中,在(您的用户名)的用户变量部分突出显示路径,然后单击编辑...

add this path: C:\\Users\\your-username\\AppData\\Local\\Android\\sdk\\platform-tools; 添加此路径: C:\\ Users \\ your-username \\ AppData \\ Local \\ Android \\ sdk \\ platform-tools;

its a default sdk path in windows OS. 它是Windows操作系统中的默认sdk路径。 if you have different location than add your sdk path, than click OK until environment variable popup close. 如果您的位置与添加sdk路径不同,则单击“ 确定”直到环境变量弹出窗口关闭。

If you already have a Command Prompt window open, close it then re-open and the adb devices command should then work. 如果您已经打开了命令提示符窗口,请将其关闭然后重新打开,然后adb devices命令应该可以正常工作。

Step 2 : 第2步 :

if its still not work than add local.properties file to your project 如果仍然无法将local.properties文件添加到您的项目中

  1. Go to your React native Project -> Android 转到您的React原生项目 - > Android
  2. Create a file local.properties 创建一个local.properties文件
  3. Open the file 打开文件
  4. paste your Android SDK path like below 粘贴您的Android SDK路径,如下所示

    in Windows sdk.dir = C:/Users/USERNAME/AppData/Local/Android/sdk 在Windows sdk.dir = C:/Users/USERNAME/AppData/Local/Android/sdk

    in macOS sdk.dir = /Users/USERNAME/Library/Android/sdk 在macOS中sdk.dir = /Users/USERNAME/Library/Android/sdk

    in linux sdk.dir = /home/USERNAME/Android/Sdk 在linux中sdk.dir = /home/USERNAME/Android/Sdk

    Replace USERNAME with your user name 将USERNAME替换为您的用户名

Now, Run react-native run-android in your terminal 现在,在您的终端中运行react-native run-android

暂无
暂无

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

相关问题 react-native - 'adb' 未被识别为内部或外部命令 - react-native - 'adb' is not recognized as an internal or external command 'adb'未被识别为内部或外部命令 - 'adb' is not recognized as an internal or external command react- native: 'adb' 不是内部或外部命令,也不是可运行的程序或批处理文件 - react- native: 'adb' is not recognized as an internal or external command, operable program or batch file adb 在 Windows 上未被识别为内部或外部命令 - adb is not recognized as internal or external command on windows 'gradlew.bat' 不被识别为内部或外部命令,反应原生 - 'gradlew.bat' is not recognized as an internal or external command, react native 'adb' 不是内部或外部命令、可运行程序或批处理文件 - 'adb' is not recognized as an internal or external command, operable program or batch file adb 不是内部或外部命令、可运行程序或批处理文件 - adb is not recognized as internal or external command, operable program or batch file 无法在 android 模拟器上运行 react-native 应用程序,因为“C:/User/firstname”未被识别为内部或外部命令 - Unable to run react-native app on android emulator because 'C:/User/firstname' is not recognized as internal or external command IntelliJ WebStorm 中的“'adb' 未被识别为内部或外部命令、可运行的程序或批处理文件” - "'adb' is not recognized as an internal or external command, operable program or batch file" in IntelliJ WebStorm C:\\ Users \\ Documents \\ Android-1 \\ Android \\ adb'无法识别为内部或外部命令,可操作程序或批处理文件 - C:\Users\Documents\Android-1\Android\adb' is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM