REACT NATIVE无法在额外的属性扩展上获取属性'compileSdkVersion',因为它不存在

jea*_*ode 2 sdk android react-native

我在React Native中遇到此错误.这个问题说要放

ext {
compileSdkVersion = 26
Run Code Online (Sandbox Code Playgroud)

}

在'顶级文件'中.React Native中的"顶级文件"是什么?

module/build.gradle 已经有了

android { compileSdkVersion rootProject.ext.compileSdkVersion...

小智 7

React Native android有两个build.gradle文件

// android/build.gradle
ext {
    buildToolsVersion = "26.0.3"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"
}

//android/app/build.gradle
android {
   compileSdkVersion rootProject.ext.compileSdkVersion
}
Run Code Online (Sandbox Code Playgroud)