Closed lucasff closed 1 year ago
Hi, I'm facing the same issue. Were you able to solve it? Thanks for some infos
Unfortunately not now :|
The difference is that when you pass deviceId
we're launching ./gradlew build
command with some additional args, but if you don't specify device we're going with ./gradlew install ...
one. Need to figure out the difference here and why it's failing. 🤔
Any help appreciated here tho 🙂
We are facing the same issue in our project. 😭
When deviceId
is used, then the logic branches to calling runOnSpecificDevice function, which internally doesn't use getTaskNames
for gradleArgs
, but a hardcoded array like ['build', '-x', 'lint']
, which then results in running ./gradlew build -x lint ...
command.
$ react-native run-android --mode=devDebug --deviceId=123 --verbose info JS server already running. info Building the app... debug Running command "./gradlew build -x lint -PreactNativeDevServerPort=8081"
This behaviour is problematic in our case due to two reasons:
buildTypes
including release
ones that do require release-key.keystore
and we don't want to share release keys with every developer that wants to build a debug version of the app on a specific device buildTypes
being built, a single build takes foreverEnvironment
System: OS: macOS 13.2.1 CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz Memory: 24.82 MB / 32.00 GB Shell: 3.5.1 Binaries: Node: 19.4.0 Yarn: 1.22.19 npm: 9.5.0 Watchman: 2022.10.17.00 Managers: CocoaPods: 1.11.3 SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 31, 33 Build Tools: 31.0.0, 33.0.0 System Images: android-31 | Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9514443 Xcode: 14.2/14C18 Languages: Java: 11.0.18 npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.2 => 0.71.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
🫡
@ventsi-staykov-mm yeah, I see the issue here... building all variants is not ideal I guess :|
I'll try to figure out better way for doing this, for time being could you try to run run-android --deviceId xxx
with --tasks
flag? You can pass any valid gradle task there, eg "installDebug".
@adamTrz, thanks for your effort!
I think an easy solution may be to use getTaskNames
with assemble
taskPrefix instead of hardcoded array for gradleArgs
. This should produce the target APK that installAndLaunchOnDevice can directly consume.
Yes, using --tasks
flag seems to be the only working solution for now
Hey @ventsi-staykov-mm you linked to the v10.1.3
but right now we're actually using getTaskNames
see here: https://github.com/react-native-community/cli/blob/63022103bebc9202d15255d8d2a6b90ce7401bf0/packages/cli-platform-android/src/commands/runAndroid/runOnAllDevices.ts#L57-L63 could you please use v11.0.0-alpha.2
and try if it's working for you?
@szymonrybczak yes because ReactNative ships with v10.1.3
, so even if v11
works as expected, we can't use it yet
Okay, so we need to wait for Core Team to release new React Native version with these changes.
Hey @ventsi-staykov-mm, you can try using 0.72.0-rc.0
which comes with 11.0.0-alpha.2
so it contains fix for issue 😄
Hey @ventsi-staykov-mm, any updates? Can I close this issue? :)
@szymonrybczak works as expected! please close it, thank you!
Environment
System: OS: macOS 12.6.1 CPU: (10) arm64 Apple M1 Max Memory: 85.56 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.18.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.19.2 - /opt/homebrew/bin/npm Watchman: 2022.10.24.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild Languages: Java: 11.0.17 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Description
react-native-cli has a different build path when passing
--deviceId
. It tries to run tasks from dependencies such asandroidJavadoc
from, in this example,react-native-auth0
. That task fails with the following error:Reproducible Demo
Use CRNA, add
react-native-auth0
and try start with a phone connected via USB, passing --deviceId