react-native: [BUG] /bin/sh: 1: adb: not found
I try run my first react native app with sudo react-native run-android
command but it’s return below output and app not running:
sudo react-native run-android
JS server already running.
/bin/sh: 1: adb: not found
Building and installing the app on the device (cd android && ./gradlew installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0392Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'Google Nexus 5X - 6.0.0 - API 23 - 1080x1920 - 6.0'
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 12.142 secs
This build could be faster, please consider using the Gradle Daemon: http://gradle.org/docs/2.4/userguide/gradle_daemon.html
/bin/sh: 1: adb: not found
Starting the app (adb shell am start -n com.myapp/.MainActivity...
As you seen it’s return /bin/sh: 1: adb: not found
two time but when I run adb devices
it’s return below output:
adb devices
List of devices attached
192.168.56.101:5555 device
192.168.56.101:5555
is my Genymotion device I also test with my Nexus 7 but again noting run on device.
I think it’s a bug because I have adb but it’s return /bin/sh: 1: adb: not found
.
Additional Info: Linux Mint 17.2 Android Platform React Native 0.39.2
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (2 by maintainers)
you need export the path of “platform-tools” inside android sdk folder
run this command with your platform-tools location and retry again
export PATH="/Users/yourUser/Library/Android/sdk/platform-tools":$PATH
I had the same problem I solved, in your project directory… sudo apt-get update sudo apt-get install adb
then
react-native run-android
You need to install adb.
Run command below to install. brew cask install android-platform-tools
If you don’t have brew installed, use this command to download that: ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
After installing ‘adb’ things working fine for me.
@koraniar It has to be something else, 200 years ago I have exported adb and other platform tools and still not working… My guess react-native is looking for adb somewhere else and in that case ignoring the ENVIRONMENT vars.
I was right… In a Linux system, react-native scripts looks for adb at /usr/local/bin/, It ignores the Environment variables. what I did was create a symlink in /us/local/bin/
That’s it
I added
export PATH=$PATH:"/Users/<your username here>/Library/Android/sdk/platform-tools"
to my.bash_profile
.installing worked for me,
brew cask install android-platform-tools
Just also ran into the same issue setting, following resolved it for me: Set ANDROID_HOME to your sdk location. (C:\users{username}\AppData\Local\Android\sdk per default)
Add the following to your PATH: %ANDROID_HOME%/tools %ANDROID_HOME%/platform-tools
Only platform-tools do not suffice. 😉
@facebook-github-bot answered