在现有 React Native 项目中安装 expo-dev-client
了解如何在现有的 React Native 项目中安装和配置 expo-dev-client。
以下指南介绍了如何在现有 React Native 项目中安装和配置 expo-dev-client
。
¥The following guide explains how to install and configure expo-dev-client
in an existing React Native project.
Do you need to create a new project?
If you're starting with a new project, create it using the with-dev-client
template:
!!!IG1!!!
Do you use Continuous Native Generation (CNG) in your project?
To use expo-dev-client
in a project that uses CNG, see Create a development build.
Prerequisites
The expo
package must be installed and configured. If you created your project with npx @react-native-community/cli@latest init
and do not have any other Expo libraries installed, you will need to install Expo modules before proceeding.
1
2
Configure deep links
Expo CLI uses a deep link to launch your project, and it's also useful if you use plan to use expo-dev-client
for launching preview updates if you have added a custom deep link scheme to your project.
If you haven't configured a scheme
for your app yet to support deep linking, then use uri-scheme
library to do this for you.
!!!IG4!!!
For more information, see the uri-scheme
library.
3
Add additional optional configuration
For certain types of errors, you can obtain more helpful error messages when using expo-dev-client
. To turn this on, import expo-dev-client
in the project's index file. Make sure that the import statement is executed early, before your application's JS code is imported (place the import above import App from './App'
).
!!!IG0!!!
For more information, see Error handling.
4
Build and install the app
Create a debug build of your app using the tools of your choice. For example, you can do this locally with Expo CLI or in the cloud with EAS Build.