question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting react-native run-android to use a custom adb.exe

See original GitHub issue

I have been trying to deploy a react-native app to the Nox emulator. Apparently, the emulator comes with its own adb.exe. More info about this: https://www.bignox.com/blog/how-to-connect-android-studio-with-nox-app-player-for-android-development-and-debug/

The problem is, everytime I run react-native run-android, the cli will fail to find a device, eventhough the custom adb.exe clearly found a device before. My guess is react-native doesn’t call the right adb.exe, because everytime I run react-native run-android, a new adb.exe process will be started. So I add a PATH to the custom adb.exe, and remove the PATH adb.exe that comes with the Android SDK. It still fails. The same thing still happens.

  1. Before running react-native run-android:
C:\Users\Jacky>adb devices
List of devices attached
127.0.0.1:62001 device
  1. On running react-native run-android:
...
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 33.883 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
  1. After running `react-native run-android:
C:\Users\Jacky>adb devices
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached

The reason that I want to use nox emulator is because the other emulators are simply too slow on my machine. I tried AVD and genymotion, both are really slow on my machine, for whatever reason. Nox though, runs very smoothly on my machine, I have even played some games on it for several months.

Can anyone help me with this? It will be really appreciated! Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ShooterArkcommented, Jan 26, 2018

Somehow I managed to solve this issue. Let me share it on this thread for future references. This solution has three parts

Mobile Emulator (NOX) (For this solution to work, you need to have NOX emulator with api >= 5) here are the steps to do that:

  1. Open Multi-Drive, a software installed with NOX by default. It will be visible on desktop but if in case its not then locate the NOX installed folder (most probably: ProgramFiles (x86)/NOX/bin) and you can find it there.
  2. Delete the default NOX emulator.
  3. At the bottom you will have a button, click that and download emulator 5.
  4. With in the Multi-drive, take the backup of the emulator in case this doesn’t work for you after downloading.
  5. Enable USB debugging in the emulator

Connectivity:

  1. Go to Android SDK Platform Tools folder (Android/sdk/platform-tools)
  2. Copy these file (adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll and rename adb.exe to nox_adb.exe
  3. Go to Nox/bin folder and paste these files copied on step 2 - Overwrite all

then just go to the react native project folder and write react-native run-android

Ps. For me this solution works with a smalllllllll exception, sometimes I get that the nox_adb.exe (check step 2 in connectivity) has stopped working but just close that window cause the emulator is working perfectly for me.

0reactions
JingweiWangcommented, Jul 24, 2018

@makiabuan I have same problem in my mac, but I already solved.

  • Firstly, you shuold check the $ANDROID_HOME in .bash_profile, make sure the following lines to your .bash_profile config file:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

WARNING: PLEASE make sure ANDROID_HOME=$HOME/Library/Android/sdk Not the other.

Windows can Refer to this configure-the-android-home-environment-variable. Don’t forget to choose the Windows environment.

If the above still doesn’t work, Do the second step:

  • Secondly, import project (/RNProject/android/) in your Android Studio. And then Run the App(^R). Then you can use react-native run-android normally.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Running On Device - React Native
To enable USB debugging on your device, you will first need to enable the "Developer options" menu by going to Settings → About...
Read more >
Getting issues with ADB for react-native run-android
ADB location: C:\Users\(USERNAME)\AppData\Local\Android\Sdk\platform-tools\adb.exe. I've been using the latest android studio client; ...
Read more >
no android connected device found and no emulators could ...
If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK...
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix this issue, upgrade your Android 11 emulator to version 9 or higher by navigating to Tools > SDK Manager. In the...
Read more >
How to fix "ADB.exe is obsolete and has serious performance ...
After opening the SDK Manager, navigate to Appearance & Behavior/System Settings/Android SDK. Then go to SDK Tools Tab and check the Show ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found