react-native-cli running unit tests when building for android 11 wifi deviceId

0
open
FrederickEngelhardt
FrederickEngelhardt
Posted 3 months ago

react-native-cli running unit tests when building for android 11 wifi deviceId #32392

Description

Connecting a android11+ device and running the command react-native run-android --deviceId adb-R1AZ705GABC-6ABGaJ._adb-tls-connect._tcp. runs android unit tests instead of build the app.

The script react-native run-android will properly target these wifi devices but running on a single device triggers the unit tests of all android modules.

React Native version:

Run react-native info in your terminal and copy the results here.

System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 4.20 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.4 - /var/folders/nn/pf3r3x090wg4ydmr7bjtx1yw0000gn/T/fnm_multishells/38414_1634116090297/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.10 - /var/folders/nn/pf3r3x090wg4ydmr7bjtx1yw0000gn/T/fnm_multishells/38414_1634116090297/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /Users/frederickengelhardt/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
      Build Tools: 23.0.1, 26.0.3, 27.0.3, 28.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0
      System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom_64, android-31 | Intel x86 Atom_64, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2.1 4.2.1
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: ~0.65 => 0.65.1
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. Follow google's documentation on how to setup a android 11 device over wifi.
  2. Connect the device.
  3. Get the deviceId adb devices. That id should look similar to this adb-R1AZ705GABC-6ABGaJ._adb-tls-connect._tcp.
  4. Run react-native run-android --deviceId <deviceId> Notice that the test builds are triggered instead.
  5. Run react-native run-android notice that the device is somehow found and builds correctly.

Expected Results

Expect that the wifi device is able to build when provided a wifi deviceId. The device can be accessed when running run-android without providing a device target. The issue is that it builds for ALL devices which is not optimal for people with multiple devices (like 5+ devices) linked via wifi.

Current workaround is using adb to target the device and for gradlew commands running ANDROID_SERIAL=<serial#> ./gradlew <taskName>. The wifi device can be targeted with adb -s <deviceId>

Snack, code example, screenshot, or link to a repository:

I also created a stack overflow issue. Posting here because it seemed like it may be a CLI limitation.

Stackoverflow post