react_native 踩坑之路

Gradle sync failed: Project with path ':react-native-code-push' could not be found in project ':app'.Consult IDE log for more details (Help | Show Log)


在react natvive version:'0.42'中遇到的问题,原因是在0.27版本以上,link的命令已经更改,但大部分网上的集成code push教程都是旧的


PLUGIN INSTALLATION (ANDROID - RNPM)

  1. As of v0.27 of React Native, rnpm link has already been merged into the React Native CLI. Simply run: react-native link react-native-code-push

    If your app uses a version of React Native that is lower than v0.27, run the following:rnpm link react-native-code-push

    Note: If you don’t already have RNPM installed, you can do so by simply running npm i -g rnpm and then executing the above command.

  2. If you’re using RNPM >=1.6.0, you will be prompted for the deployment key you’d like to use. If you don’t already have it, you can retreive this value by running code-push deployment ls -k, or you can choose to ignore it (by simply hitting ) and add it in later. To get started, we would recommend just using your Staging deployment key, so that you can test out the CodePush end-to-end.

好文====================================================================

react native codepush

react-native-art

====================================================================


原生引入rn,出现如下问题:

Error:Error converting bytecode to dex:Cause: com.android.dex.DexException: Multiple dex files define Lokhttp3/internal/ws/RealWebSocket$1;

原因是原生引入了retrofit2,rn和retrofit2都使用了okhttp3,所以引起了冲突,解决方式如下:

compile('com.facebook.react:react-native:+'){
    exclude(module: 'okhttp-ws', group: 'com.squareup.okhttp3')
}
但这里有个很奇怪的问题,我这边exclude的'okhttp-ws', 但我看了retrofit2的引用,里边是没有这个模块的,折腾了一下午没找出原因,刚看了下错误中的冲突类的源码位置,
原来已经集成在了okhttp3里边,只但rn那还是单独引入的。

fresco加载gif bug:rn 0.42 默认使用的 fresco 1.0.1版本,这个版本要使用gif功能是会报错的,我只有在1.3.0版本才能正常加载gif。github地址
使用codepush进行热更新后图片是显示性能问题,我这是热更新了点击切换背景图片的view,然后点击时就会出现明显的加载性能问题,图片切换会有明显的滞后感。github issues

你可能感兴趣的:(react_native 踩坑之路)