Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native 热更新探索 #15

Open
rccoder opened this issue May 5, 2017 · 6 comments
Open

React Native 热更新探索 #15

rccoder opened this issue May 5, 2017 · 6 comments

Comments

@rccoder
Copy link
Member

rccoder commented May 5, 2017

@rccoder
Copy link
Member Author

rccoder commented May 6, 2017

安卓打包找不到 ChoreographerCompat

microsoft/react-native-code-push#792

版本问题

Upgrade RN to 0.43.x version and use react-native-code-push 2.0.x versions
Use react-native-code-push 1.17.x versions with RN 0.40-0.42 versions.

@rccoder
Copy link
Member Author

rccoder commented May 6, 2017

@rccoder
Copy link
Member Author

rccoder commented May 7, 2017

iOS CodePush 集成

按照官网指导,SDK 直接用 rnpm 集成,提前注册好 CodePush 和 APP,记下 key

参考 CodePush Demo,用 CodePush 包裹 RN 组件

用相关命令导出 bundle,CodePush 发布相关 bundle

Xcode。command + shift + , 选择 release 即可使打 release 包,测试 CodePush 效果。(打包如果测试出现问题,直接在 build 里忽略掉测试)

@rccoder
Copy link
Member Author

rccoder commented May 7, 2017

Android CodePush 集成

目前存在问题

Caused by: com.microsoft.codepush.react.CodePushNotInitializedException: A CodePush instance has not been created yet. Have you added it to your app's list of ReactPackages?

看官方 Demo,发现 rnpm 修改貌似不完善,修改 MainApplication.java,添加 CodePush:

@Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
              new MainReactPackage(),
              new CodePush(getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG),
              new BaiduMapPackage(getApplicationContext())
      );
    }

然后出现:

Could not get BatchedBridge, make sure your bundle is packaged properly” on start of app

参考下面:

react-native run-android 启动:

react-native run-android
react-native start --reset-cache

可以运行了

额外小记

开启 AVD 虚拟机时候出现:

Starting emulator for AVD 'x86_QVGA_Level10'
emulator: device fd:1044
HAX is working and emulator runs in fast virt mode
emulator: Failed to sync vcpu reg
emulator: Failed to sync HAX vcpu context

是 Docker 在跑的问题,关掉就行

@rccoder
Copy link
Member Author

rccoder commented May 11, 2017

总结文章
rccoder/blog#27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant