Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jackyef opened this issue Apr 8, 2017 · 11 comments
Closed

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

jackyef opened this issue Apr 8, 2017 · 11 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jackyef
Copy link

jackyef commented Apr 8, 2017

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!

@jjsaguit
Copy link

+1

@hramos
Copy link
Contributor

hramos commented Jul 25, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Jul 25, 2017
@hramos hramos closed this as completed Jul 25, 2017
@oscar10176
Copy link

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

@biswatmanayak
Copy link

Can anyone help me to fix same issue on Windows machine?
I have been trying to run on NOX layer still stucked from 2 days

@mrsof
Copy link

mrsof commented Sep 27, 2017

I am in the same case as @jackyef .
+1 to reopen this issue.

@nighttiger1990
Copy link

I have same problem, Im using NOX,too. When create app using create-react-native-app, and using npm start my nox was detected. But when create app using react-native init, and using react-native run-android, always get no detected devices

@ShooterArk
Copy link

ShooterArk commented 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.

@makiabuan
Copy link

@ShooterArk
I followed all the steps

I got this
File 'C:\Users\MyComputer\AppData\Local\Android\sdk\platform-tools\adb.exe' specified for property 'adbExe' does not exist.

In your Connectivity step 2 you said rename the adb.exe to nox_adb.exe inside the sdk/platform-tools folder

what did I do wrong?

@ShooterArk
Copy link

@makiabuan did you make a copy in the NOX folder and then renamed it to nox_adb.exe ?

@Adrek
Copy link

Adrek commented Jun 23, 2018

@ShooterArk Thanks bro. Your solution works perfectly.
I followed this steps:
1- You have to do everything he says in the ShooterArk's response: #13397 (comment)
2- When you finished step 1, then you have to do all of this video: https://www.youtube.com/watch?v=cBUhcRZ5BPM

@JingweiWang
Copy link

@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.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 25, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests