react-native CodePush的安装(个人笔记)

参考地址如下:

https://github.com/lisong/code-push-server/blob/master/docs/react-native-code-push.md

https://www.jianshu.com/p/87ccfb795635

配置:

1、在android/settings.gradle下

include ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
2、在android/app/build.gradle添加Code-Push的依赖
compile project(':react-native-code-push')
3、在android/app/build.gradle添加codepush.gradle 任务
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
4、在MainApplication.java文件中

public class MainApplication extends Application implements ReactApplication {
@Override
    protected String getJSBundleFile() {
      return CodePush.getJSBundleFile();
    }
 @Override
    protected List getPackages() {
      return Arrays.asList(
              new CodePush(
                      "YourKey",
                      MainApplication.this,
                      BuildConfig.DEBUG,
                      "YourCodePushServerUrl"
              )
      );
    }
}




你可能感兴趣的:(React,Native)