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.

Flags to skip launching the emulator for `run-android`

See original GitHub issue

Describe the Feature

In the current version, an emulator will be launched when we run react-native run-android ... and there is no way to skip launching it.

In my project, the use case of run-android is to run different gradle tasks like the following which doesn’t need the emulator at all.

$ react-native run-android --tasks clean,assembleRelease,uploadRelease

However, the emulator will be launched for every run of run-android and I have to close it again and again.

This is actually a dilemma that we can definitely use the original gradle cli. In this case, we need to run the jetifier on our own and this is not the optimal scenario.

Possible Implementations

Support a new flag, e.g. --no-emulator and add a condition at https://github.com/react-native-community/cli/blob/a5d837543dad8b3f40b4d2449963542e5d3abefe/packages/platform-android/src/commands/runAndroid/runOnAllDevices.ts#L39

Related Issues

n/a

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mauscoelhocommented, Apr 30, 2020

This can also help some CI like Bitrise, today when you run with the purpose of generating an apk you will get an error

$ react-native run-android --variant=release
Execution failed for task ':app:installRelease'.
> com.android.builder.testing.api.DeviceException: No connected devices!

We could avoid it using

$ react-native build-android --variant=release
0reactions
cortinicocommented, Oct 24, 2022

If anyone has an android device plugged in

That’s a workaround. The solution to this issue can’t be just “plug an android device”.

What I think we need is having build-android and build-ios that share their backend with run-* commands, but without starting Metro instance and booting up a simulator. We also need the --mode flag mentioned in #179.

+1 for this approach

Read more comments on GitHub >

github_iconTop Results From Across the Web

Start the emulator from the command line - Android Developers
Use the emulator command to start the emulator, as an alternative to running your project or starting it through the AVD Manager. Here's...
Read more >
Android emulator never finishes booting when "-no-window ...
I ssh into the remote machine with the "-Y" flag so that the rendering will appear on my local machine: · When connected...
Read more >
Skipping "Welcome to Chrome" - Google Groups
I've attempted to add flags to skip it with adb shell --no-first-run and ... My env is OS X running protractor with appium...
Read more >
How to Launch Android Emulators and iOS Simulators From ...
One important note: when you run the emulator command with the -avd flag, the process that controls the AVD remains active in your...
Read more >
Emulate Android and iOS Apps with Ionic Cordova Emulator
Options​ ; Deploy build to an emulator · Do not use native-run to run the app; use Cordova instead ...
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