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

我与影子孤独终老i 提交于 2019-12-01 06:25:23

问题


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 }


回答1:


First of all you have to set environment variable of your android sdk's platform-tool

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;

its a default sdk path in windows OS. if you have different location than add your sdk path, than click OK until environment variable popup close.

If you already have a Command Prompt window open, close it then re-open and the adb devices command should then work.

Step 2 :

if its still not work than add local.properties file to your project

  1. Go to your React native Project -> Android
  2. Create a file local.properties
  3. Open the file
  4. paste your Android SDK path like below

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

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

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

    Replace USERNAME with your user name

Now, Run react-native run-android in your terminal



来源:https://stackoverflow.com/questions/48898079/in-react-native-adb-is-not-recognized-as-an-internal-and-external-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!