3

I am trying to start my hello world app using react native using windows 7 and an android device. There is a similar issue here but I have failed make it work.

Commands I have run so far to set up and lead to this issue.

  1. Created the app: react-native init helloMe
  2. Moved to the root Dir[helloMe]. react-native run-android
  3. Android Device is set up okay and showing in CMD using adb
  4. Opened another CMD window then ran: react-native start
  5. Ran react-native run-android again.
  6. Red Screen is shown on phone with this error unable to load script from assets index.android.bundle on windows
  7. Trying to fix it with the solution in step 6 leads to another error which is why I am here. below is my CMD log.

    E:\testdir\react_ws\helloMe>react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
    Scanning 558 folders for symlinks in E:\testdir\react_ws\helloMe\node_modules (30ms)
    Scanning 558 folders for symlinks in E:\testdir\react_ws\helloMe\node_modules (20ms)
    Loading dependency graph, done.
    Cannot find entry file index.android.js in any of the roots: ["E:\\testdir\\react_ws\\helloMe"]
    E:\testdir\react_ws\helloMe>
    

Now I am getting another error when I try to fix the problem with the above solution.

Cannot find entry file index.android.js in any of the roots: ["E:\\testdir
\\react_ws\\helloMe"]

If have tried to apply this fix from here

npm run start -- --root <directory_with_your_react_component_js_sources>

I since I am running the command in the project root, I ran this instead npm run start -- --root ./ but it did not work.

This is my root project structure

__tests__  app.json          index.ios.js  node_modules  yarn.lock
android    index.android.js  ios           package.json

I hope I am clear, any help would be highly appreciated. Device is stuck on red screen with a 404.

React-native-version

react-native-cli: 2.0.1
react-native: 0.46.0

Thanks. Requested Project root Structure Snapshot

CMDNPM StartSceenshot 2

IsaacK
  • 1,178
  • 1
  • 19
  • 49

2 Answers2

2

Changed the version of react project to a lower one from here

npm install -g rninit

rninit init [Project Name] --source react-native@0.40.0

Worked okay for both on both iOS and Android on . If you get Error Could not get BatchedBridge. run this

adb reverse tcp:8081 tcp:8081

This worked for me.

IsaacK
  • 1,178
  • 1
  • 19
  • 49
0

1: In cmd With This Command ipconfig Find Your ip
And put that in Dev Sttings => Debug server host& port for device

2: turn on your Device wifi

a

And

b

Saeed Heidarizarei
  • 8,406
  • 21
  • 60
  • 103