Uh oh!
There was an error while loading. Please reload this page.
run-android-on-specific-device - #9568
Conversation
facebook-github-bot
commented
Aug 24, 2016
ab5ff96 to
36f98eaCompareghost
commented
Aug 24, 2016
@LearningDave updated the pull request - view changes |
ghost
commented
Aug 24, 2016
@LearningDave updated the pull request - view changes |
LearningDave
commented
Aug 26, 2016
mkonicek
commented
Sep 5, 2016
Nice! This is useful. Looks like there is a lot of code in e.g.: Would it be possible to refactor the code? It looks like this PR adds some logic that's already in that file. nit: Instead of |
There was a problem hiding this comment.
Why Promise? Is the buildApk function async?
There was a problem hiding this comment.
Hi, thanks for the feedback.
i called it '--deviceIdFromList' because its not the actually device id. It is just the id created by adb. -> https://developer.android.com/studio/command-line/adb.html#commandsummary
However '--deviceId' might still be better, since it is easier to use.
I will do some refactoring and remove the promise on buildApk.
ghost
commented
Sep 6, 2016
@LearningDave updated the pull request - view changes |
LearningDave
commented
Sep 6, 2016
@mkonicek I've done some refactoring, changed the flag to '--deviceId' and removed the misplaced promise. |
There was a problem hiding this comment.
nit (wording): given device id (listed by running "adb devices" on the command line).
(no space after the last .)
mkonicek
commented
Sep 8, 2016
Thanks for refactoring this @LearningDave. It's a useful feature, it'll take me a while to review since it's quite a bit of code. Have you run the test plan again after refactoring? |
There was a problem hiding this comment.
Could you call adb.getDevices rather than reimplement it here?
https://github.com/facebook/react-native/blob/b9396cd74419dd4165fb051605076d19b1c18905/local-cli/runAndroid/adb.js#L38
mkonicek
commented
Sep 8, 2016
OK I did a basic review :) |
mroswald
commented
Oct 24, 2016
@LearningDave could you please rebase your branch against current master? thanks! |
hramos
commented
Nov 7, 2016
@LearningDave are you still planning to ship this? |
Summary: New flag for the command 'run-android': --deviceIdFromList <deviceIdFromList> in order to install and launch apps on a specific device/simulator from the command line. <deviceIdFromList> is the id listed on the output of the command 'adb devices'
adc2301 to
1879a1cCompareLearningDave
commented
Nov 23, 2016
| const fs = require('fs'); | ||
| const isPackagerRunning = require('../util/isPackagerRunning'); | ||
| const path = require('path'); | ||
| const isPackagerRunning = require('../util/isPackagerRunning'); |
| const path = require('path'); | ||
| const isPackagerRunning = require('../util/isPackagerRunning'); | ||
| const Promise = require('promise'); | ||
| const adb = require('./adb'); |
| adb.getDevices().map((device) => tryRunAdbReverse(device)); | ||
| console.log(chalk.bold( | ||
| 'Building the app...' | ||
| )); |
| }); | ||
| } catch (e) { | ||
| console.log(chalk.red( | ||
| 'Could not build the app on the device, read the error above for details.\n' |
There was a problem hiding this comment.
We are not building the app on the device. We are either building the app, or installing it on device.
mkonicek
commented
Dec 15, 2016
Just small nits, we can fix these as a followup. Thanks for working on this! @facebook-github-bot shipit |
facebook-github-bot
commented
Dec 15, 2016
@mkonicek has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
mkonicek
commented
Dec 16, 2016
@LearningDave are you up for sending a small followup PR for fixing the small nits above? |
mroswald
commented
Dec 19, 2016
@LearningDave if you want I can take over the improvements PR - will ping you on mail too |
| command: '--flavor [string]', | ||
| description: '--flavor has been deprecated. Use --variant instead', | ||
| }, { | ||
| command: '--configuration [string]', |
There was a problem hiding this comment.
Why did you removed the configuration flag? This is a breaking change.
Summary: As mkonicek suggested in [#9568](#9568 (comment)) I did some cleanup **Test plan (required)** Only one functional change: > Run `react-native run-android --deviceId` Before it was beginning to build the app and then failing because of the missing device "true" :-) Now it's showing a message and stopping the build: ``` ❯ react-native run-android --deviceId Starting JS server... Parameter missing (device id) ``` Closes#11703 Differential Revision: D4376615 Pulled By: ericvicenti fbshipit-source-id: 3c6e0f12220ab22539c7bc3d390367e02c96728a
Summary: At the moment the run-android command from the react-native cli does run all available devices at once. However it would be extreme useful to have the option to choose only one specific device/simulator. Therefore i've created a new flag for the command 'run-android': --deviceIdFromList 'deviceIdFromList' in order to install and launch apps on a specific device/simulator from the command line. 'deviceIdFromList' is the id listed on the output of the command 'adb devices'. I've tested my code with the following commands: react-native run-android --deviceIdFromList "Not existing id" react-native run-android --deviceIdFromList react-native run-android --deviceIdFromList "id of a simulator" react-native run-android --deviceIdFromList "id of a device" Output:  ) I did some cleanup **Test plan (required)** Only one functional change: > Run `react-native run-android --deviceId` Before it was beginning to build the app and then failing because of the missing device "true" :-) Now it's showing a message and stopping the build: ``` ❯ react-native run-android --deviceId Starting JS server... Parameter missing (device id) ``` Closesreact/react-native#11703 Differential Revision: D4376615 Pulled By: ericvicenti fbshipit-source-id: 3c6e0f12220ab22539c7bc3d390367e02c96728a

Summary
At the moment the run-android command from the react-native cli does run all available devices at once. However it would be extreme useful to have the option to choose only one specific device/simulator.
Therefore i've created a new flag for the command 'run-android': --deviceIdFromList 'deviceIdFromList' in order
to install and launch apps on a specific device/simulator from the command line.
'deviceIdFromList' is the id listed on the output of the command 'adb devices'.
Tests:
I've tested my code with the following commands:
react-native run-android --deviceIdFromList "Not existing id"
react-native run-android --deviceIdFromList
react-native run-android --deviceIdFromList "id of a simulator"
react-native run-android --deviceIdFromList "id of a device"
Output:





