Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react- native: 'adb' is not recognized as an internal or external command, operable program or batch file

Am new to react-native android app development. Please help me solve this issue.

Am not able to run my first application, am getting error as adb' is not recognized as an internal or external command, operable program or batch file.

I checked inside android sdk->platform-tools->i can see adb.exe there.

Build is successfull but getting error during run time. Below is my cmd prompt

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
E:\ReactWorkSpace\MyFirstApp>react-native run-android
Scanning 560 folders for symlinks in E:\ReactWorkSpace\MyFirstApp\node_modules (72ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportRecyclerviewV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:app:prepareComFacebookFrescoDrawee101Library
:app:prepareComFacebookFrescoFbcore101Library
:app:prepareComFacebookFrescoFresco101Library
:app:prepareComFacebookFrescoImagepipeline101Library
:app:prepareComFacebookFrescoImagepipelineBase101Library
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library
:app:prepareComFacebookReactReactNative0434Library
:app:prepareComFacebookSoloaderSoloader010Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:transformClassesWithDexForDebug
Running dex in-process requires build tools 23.0.2.
For faster builds update this project to use the latest build tools.
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:installDebug
Installing APK 'app-debug.apk' on 'A16 - 4.2.2' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 7 mins 4.412 secs
'adb' is not recognized as an internal or external command,
operable program or batch file.
Starting the app (D:\Android\sdk/platform-tools/adb shell am start -n com.myfirstapp/.MainActivity...
Starting: Intent { cmp=com.myfirstapp/.MainActivity }

E:\ReactWorkSpace\MyFirstApp>

Am not using emulator, am using my own mobile device. App is launched in my device but all i see is a white blank screen. I followed all the instructions properly as mentioned in the official website.

Thank you.

like image 253
basavaraj_S Avatar asked Apr 23 '17 05:04

basavaraj_S


People also ask

Why is ADB not detecting my device?

It might be that the ADB issue is not with your computer but is with your Android device. In most cases, ADB cannot recognize your device because the USB debugging option is turned off on the device. Turning this option on can fix the issue for you and this is pretty easy to do.

Why is ADB not working?

Failed ADB connections usually have one root cause: bad Android USB drivers that load in place of the right ones. Windows doesn't make it easy to remove the wrong drivers, unfortunately. But before attempting to troubleshoot an ADB connection, first enable USB debugging on your phone if it's not on already.


2 Answers

I found the solution for this.

All you have to do is add the adb path in system variable.

Copy the adb location, and goto Controlpanel->System->Advnaced System Settings->Environment Variables->Under System Variables you will find PATH variable, selct that first and click on Edit, then click on New and paste your adb path, now click Ok. Thats it problem solved.

Now restart your command prompt, and run react-native run-android. It works:)

Hope this helps someone. Thanks for checking out my question.

like image 150
basavaraj_S Avatar answered Sep 21 '22 23:09

basavaraj_S


It is based upon your IDE, If you are using Webstorm you have to go to Settings -->Appearance & Behaviors --> Path Variable. Now you will get the new window that might have been empty. Top-Right of the you will see "+" icon you have to select that one and set your variable. My Variable is like:

Name: ANDROID_HOME Value: D:\Android_SDK\platform-tools.

like image 39
HM Hamza Zubair Avatar answered Sep 19 '22 23:09

HM Hamza Zubair