cli icon indicating copy to clipboard operation
cli copied to clipboard

run-android not working

Open dougg0k opened this issue 4 months ago • 1 comments

Environment

info Fetching system and libraries information...
System:
  OS: Linux 6.15 Arch Linux
  CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor
  Memory: 19.00 GB / 31.24 GB
  Shell:
    version: 0.104.1
    path: /home/user/.cargo/bin/nu
Binaries:
  Node:
    version: 22.16.0
    path: ~/.local/share/mise/installs/node/22.16.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.local/share/mise/installs/yarn/1.22.22/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.local/share/mise/installs/node/22.16.0/bin/npm
  Watchman:
    version: 20250525.093350.0
    path: /usr/bin/watchman
SDKs:
  Android SDK:
    API Levels:
      - "35"
      - "36"
    Build Tools:
      - 35.0.1
      - 36.0.0
    System Images:
      - android-36 | Google APIs Intel x86_64 Atom
    Android NDK: 27.2.1247901
IDEs:
  Android Studio: AI-243.26053.27.2432.13536105
Languages:
  Java:
    version: 21.0.2
    path: /home/user/.local/share/mise/installs/java/21.0.2/bin/javac
  Ruby:
    version: 3.4.4
    path: /home/user/.local/share/mise/installs/ruby/3.4.4/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: ^18.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.79.3
    wanted: 0.79.3
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Emulator is not open and jdk version 21 should still work.

Edit: I just tried with JDK 20, same thing. Just didnt get the error in the react-native doctor output.

❯ pnpm dlx react-native doctor                                                                                                       12:29:29
Common
 ✓ Node.js - Required to execute JavaScript code
 ✓ yarn - Required to install NPM dependencies
 ✓ npm - Required to install NPM dependencies
 ✓ Metro - Required for bundling the JavaScript code

Android
 ✖ Adb - No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device.
 ✖ JDK - Required to compile Java code
   - Version found: 21.0.2
   - Version supported: >= 17 <= 20
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
 ✓ Gradlew - Build tool required for Android builds
 ✓ Android SDK - Required for building and installing your app on Android

Errors:   2
Warnings: 0

Description

I recently did a major upgrade to latest RN version in a somewhat older project. And I noticed in this system, when running react-native run-android, it hangs, it shows no message, no error.

I tried finding the cause, and nothing. I then tried in a empty project with npx @react-native-community/cli@latest init and the same behavior occured.

After that, I tried in a project bootstrapped by ignite-cli, which brought expo as the runner, even though I choose bare workflow. And that worked.

I have the project setup with pnpm. If I try with npm, it shows some logs, but nothing relevant. Even in the .log file generated, there is nothing indicating anything. I also tried with --verbose, same result.

I tried the CLI version 17,18 and 19. Same result.

✗ ll android/gradlew                                                                                
Octal Permissions Links Size User    Group   Date Modified Git Name
0755  .rwxr-xr-x      1 8,8k user user 10 jun 10:11   N-  android/gradlew*

If I run the command ps aux | grep react-native, this is the result.

user    28519  0.7  0.3 11657204 117296 pts/1 Sl+  12:35   0:00 node /mnt/NVME500GB/projects/project_app/node_modules/.bin/../.pnpm/[email protected]_@[email protected]_@[email protected]_typescript@5._131331164c62c60ee148ac328a34e83f/node_modules/react-native/cli.js run-android --verbose
user    28542  1.3  0.3 11777064 126228 pts/1 Sl+  12:35   0:00 node /mnt/NVME500GB/projects/project_app/node_modules/react-native/cli.js start --port 8081

I tried run-ios on linux, which is obviously not supported, it went through.

> react-native run-ios

✔ Installing Ruby Gems
...

Where android

> react-native run-android --verbose


How to get this working and/or better debug it? I'd rather use it instead of expo-cli, in non-expo project.

Reproducible Demo

I mean, run react-native run-android --verbose in a project from scratch. Since it gave the same behavior.

dougg0k avatar Jun 10 '25 15:06 dougg0k