安装插件
1 | npm install --save react-native-code-push |
Android
安装插件
- 在您的
android/settings.gradle
文件中,添加以下内容:
1 | include ':app', ':react-native-code-push' |
- 在
android/app/build.gradle
文件中,将文件添加codepush.gradle
为下面的其他构建任务定义react.gradle
:
1 | ... |
- MainApplication.java通过以下更改更新文件以使用CodePush:
1 | ... |
- 将部署密钥添加到strings.xml:
为了让CodePush运行时知道它应该查询哪些部署更新,请打开您的应用程序的strings.xml
文件,并添加一个名为新的字符串CodePushDeploymentKey
,要配置对这个应用程序(如为关键,它的值是部署的关键Staging
部署的FooBar
应用程序)。您可以通过appcenter codepush deployment list -a
为了有效利用与CodePush应用程序一起创建的Staging
和Production
部署,请在实际将您的应用程序对CodePush的使用移入生产之前,请参考下面的多部署测试文档。