将ReactNative升级到0.55.4并且android build compile出错

时间:2018-05-26 23:28:30

标签: android react-native react-native-config

将项目更新为RN ^0.55.4

后,构建失败

似乎问题与react-native-config依赖关系Android BuildVersion 23.0.1

有关

{@ 1}} bin已弃用,我们将改为使用android

sdkmanager

某些依赖版本:

$ ~/Android-sdk/tools/bin/sdkmanager --version

26.1.1

编译错误:

"react": "^16.3.2",
"react-native": "^0.55.4",
"react-native-calendars": "^1.19.3",
"react-native-config": "^0.11.5",

您的回购中的更多说明

https://github.com/luggit/react-native-config/issues/254

编辑 - 这是一个RN问题

现在我知道它是一个ReactNative问题,所以我创建了一个:

https://github.com/facebook/react-native/issues/19467

请有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

尝试在android.enableAapt2=false中添加android/gradle.properties 参考:https://github.com/facebook/react-native/issues/16906

或者在android/app/build.gradle

中添加
subprojects {
  project.configurations.all {
      afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 26
                buildToolsVersion '26.0.2'
            }
        }
    }
     resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "26.0.2"
        }
     }
  }
}

26.0.2是/android/app/build.gradle buildToolsVersion中使用的版本 对于Gradle v4.4,最低版本为27.0.3。

参考:https://github.com/facebook/react-native/issues/19239