facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.52k stars 24.27k forks source link

Not Working in real device in debug mode #42009

Closed RutvinBhanderi closed 2 months ago

RutvinBhanderi commented 9 months ago

Description

I installed new react native project and its working well in the simulator. but when I built in real device in debug mode it was showing paseExecution error. then i found some solution that i have to change something in build phase.

  1. In the build phase I marked for install builds only inside the Bundle React Native code and images Screenshot 2023-12-20 at 11 57 02 AM

then it is building successfully but when the app opens it stuck at splash screen. i got this error. Screenshot 2023-12-20 at 12 02 06 PM

Steps to reproduce

  1. Initialize the new react native app npx react-native@latest init AwesomeProject

  2. mark For install build only (Build phase > Bundle React Native code and images)

  3. run code in real device

React Native Version

0.73.1

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M1
  Memory: 67.70 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn: Not Found
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman:
    version: 2022.11.07.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.18
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

dyld[932]: Library not loaded: @rpath/OpenSSL.framework/OpenSSL
  Referenced from: <C17BD18C-F8E6-38B9-91F4-52A8CE635CFA> /private/var/containers/Bundle/Application/250C2226-652A-452C-8E9B-1892DD0840E9/AwesomeProject.app/AwesomeProject
  Reason: tried: '/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/250C2226-652A-452C-8E9B-1892DD0840E9/AwesomeProject.app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/250C2226-652A-452C-8E9B-1892DD0840E9/AwesomeProject.app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/250C2226-652A-452C-8E9B-1892DD0840E9/AwesomeProject.app/Frameworks/OpenSSL.framework/OpenSSL' (no such file), '/private/var/containers/Bundle/Application/250C2226-652A-452C-8E9B-1892DD0840E9/AwesomeProject.app/Frameworks/OpenSSL.framework/OpenSSL' (no such file)

Reproducer

https://github.com/RutvinBhanderi/react-native-reproducer

Screenshots and Videos

No response

Hao-yiwen commented 9 months ago

I think maybe you should change your openssl version.Or run bundle install in your root of project.

RutvinBhanderi commented 9 months ago

I think maybe you should change your openssl version.Or run bundle install in your root of project.

i did bundle install but not working.

then i markled install build only ([CP] Embed Pods Frameworks,[CP] Copy Pods Resources) inside build phase but its showing library not loaded. Screenshot 2023-12-21 at 10 35 51 AM

TomWq commented 9 months ago

The same problem, there is no solution

mmilvydas112 commented 9 months ago

My solution was network related. Make sure to turn off antivirus, or just open 8081 port for all network traffic in antivirus firewall settings (which solved issue for me)

cipolleschi commented 9 months ago

Hi @RutvinBhanderi, thanks for the issue.

What is MobileVLCKit? It is not something that comes with React Native and it is that thing that is making your app fail. It does not seem to be a React Native issue. For another issue, I just installed a React Native app on my physical devie in both Debug and Release mode.

As of today, we are aware of an issue with React Native on device but only if you run pod install with the USE_FRAMEWORKS=dynamic option turned on, which is not the default settings.

From your log, it looks like you have some dylibs... What setup are you using?

github-actions[bot] commented 9 months ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
RutvinBhanderi commented 9 months ago

USE_FRAMEWORKS

I am using vlc media player but that is not the issue even if i remove the vlc library then also it is coming. i have created complete new project to test this in new project also it is not building in physical device with debug mode. this is how my podfile looks Screenshot 2023-12-28 at 12 27 22 PM

cipolleschi commented 9 months ago

Can you report exactly which command you issued/what did you do to run it on device?

I did it yesterday and it worked with no issues (I only had to change the bundle id to match the provisioning profiles, of course).

RutvinBhanderi commented 9 months ago

Can you report exactly which command you issued/what did you do to run it on device?

I did it yesterday and it worked with no issues (I only had to change the bundle id to match the provisioning profiles, of course).

in xcode i just edit schema to debug mode and just build in my phone. xcode version :- 15.1

getting this error :- Command PhaseScriptExecution failed with a nonzero exit code

danidaryaweesh commented 9 months ago

@RutvinBhanderi I had the exact same issue and it turns out that RN was not bundling my index file because I'm using Typescript, so my bundle file is index.tsx and it expects index.js. Check that out if you're using Typescript in your project.

RutvinBhanderi commented 9 months ago

@RutvinBhanderi I had the exact same issue and it turns out that RN was not bundling my index file because I'm using Typescript, so my bundle file is index.tsx and it expects index.js. Check that out if you're using Typescript in your project.

i am not using typescript. initially the project was generated in typescript but i changed app.tsx and index.tsx file to .js

cipolleschi commented 9 months ago

@RutvinBhanderi can you follow the steps highlighted here to properly understand which script is failing? It is hard to help without knowing what's going on.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.