Giter Club home page Giter Club logo

blog's People

Contributors

codingpapi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

blog's Issues

ReactNative从0.47 升级到0.56遇到的问题

Gradle

  • The SDK Build Tools revision (23.0.1) is too low for project ':aliyun-oss-react-native-sdk'. Minimum required is 25.0.0

    第三方库使用的buildToolsVersion版本太低,不需要手动修改库内容,在android/build.gradle中添加以下内容,强制所有依赖使用相同版本。

    subprojects {
       afterEvaluate {project ->
           if (project.hasProperty("android")) {
               android {
                   compileSdkVersion 26
                   buildToolsVersion '26.0.3'
               }
           }
       }
    }
  • Could not find method google() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

    这个问题的本质是gradle版本过低
    可通过手动修改第三方库build.gradle文件,把google()函数替换为maven链接 maven{url
    'http://maven.aliyun.com/nexus/service/local/repositories/google/content/'}
    或者升级gradle版本到3.0之上,就不用改第三方库了

  • Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

    gradle 版本太低,只能通过升级gradle版本解决
    https://gist.github.com/nazrdogan/87c63e89a2bfd4cefee24990e4e7ed0e

  • uncompiled PNG file passed as argument. Must be compiled first into .flat file..

    依赖库以及react-native对gradle3.0以上版本适配有问题,主要是高版本gradle使用Aapt2替换了Aapt打包应用资源。上面有依赖需要升级gradle版本到3.0,官方又对3.0依赖支持差。两种办法可以尝试把这个问题暂时绕过去

    • CFKevinRef/react-native@78577cc 修改了react.gradle文件,支持aapt2。但是由于RN自身和众多第三方库不支持,该合并已经被React-native团队回退,没有带入到0.56版本。我们可以手动替换该文件。我试了下,遇到依赖资源重复的问题。
      facebook/react-native#17967
      facebook/react-native#18189
      众多大神吐槽 :)

      I wouldn't be surprised to see more people try out Flutter

    • 或者配置 android.enableAapt2=false react-navigation/react-navigation#3097
      这个也会遇到资源重复
      资源重复或使用gradle配置在打包时去掉重复资源,或者手动去掉重复资源,然后使用AndroidStudio打包。
  • Cannot merge new index 68188 into a non-jumbo instruction!

    方法数量超过单dex上限
    https://stackoverflow.com/questions/26093664/dexexception-cannot-merge-new-index-65536-into-a-non-jumbo-instruction

babel

  • Cannot read property 'bindings' of null

    babel-preset-react-native 版本过低
    facebook/react-native#20042

  • comma issue

    Node7 不再支持尾comma,{ temp, } 写法会报错,导致第三方库编译不过。
    自己clone库,修改代码

  • react-native-modal编译不过

    babel有bug,需要升级react-native-modal库规避

第三方依赖问题

  • Unable to resolve module react-native/Libraries/StyleSheet/normalizeColor from /home/supermario/Nodejs/test/fromScrach/Sinopec/node_modules/antd-mobile-rn/lib/segmented-control/segmented.android.js: Module react-native/Libraries/StyleSheet/normalizeColor does not exist in the Haste module map

    antd-mobile-rn 库使用了react-native弃用迁移的变量。最新版本的antd库就有问题,没法升级,我们会只有一个weldNew页面用到了SegmentedControl控件,可以考虑替换该控件。

运行时崩溃

  • react-native 的 自带Image控件

    运行时崩溃。未找到原因。自此卡住
    7.9号 灵感一现,继续
    resizeMode={Image.resizeMode.cover} 替换为 resizeMode="cover"

  • NavigationActions.reset undefined

    NavigationActions库版升级导致的不兼容, reset 方法被移到新的StackActions中了

资源重复问题

  • init一个新项目,一点一点把代码和依赖加进去,替换react.gardle,重新build,资源重复的问题消失了
  • 看到旧项目中冲突的资源是drawable文件夹中以src开头的一些图片,推测是之前版本编译自动生成。全部删除
  • 删除所有drawable-开头的资源文件夹,保留mipmap-开头的文件夹

遗留问题

  • 由于antd-mobile-rn库在0.56中崩溃,weldNew中,需要替换掉SegmentedControl控件

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.