简体   繁体   中英

how to install react native app onto phone

(This is probably a very short and general question)

I tried to install my react-native app onto my phone without using expo.

I was able to install my react native app onto my phone via android studio, but I get an error message stating that I need to run the metro server (Which I do). How do I fix this, and, would this mean that I cannot run any react native apps without a server? What would I do if I want to create an offline application?

What is the most sensible way of getting around all of this?

In dev mode react native run an server that serves the js bundle on port 8081 by default.

On android studio, the bundle location is set to localhost:8081

If you want your phone to connect to the server you may have to change the bundle location to point to your pc ip adress intead of localhost. So you would have something like 192.168.1.x:8081

And if you want to run your app without the bundle server, you must build if for production like environement, it's like building an apk for google play store. You may want to check the official documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM