React-Native Android 生成 Signed apk: Build Gradle 错误

React-Native Android generate Signed apk: Build Gradle error

Build.gradle 第 2 行错误。 我按照 https://facebook.github.io/react-native/releases/0.31/docs/signed-apk-android.html

中描述的步骤操作
// Top-level build file where you can add configuration options common to all sub-projects/modules.

signingConfigs {
    release {
        storeFile file(MYAPP_RELEASE_STORE_FILE)
        storePassword MYAPP_RELEASE_STORE_PASSWORD
        keyAlias MYAPP_RELEASE_KEY_ALIAS
        keyPassword MYAPP_RELEASE_KEY_PASSWORD
    }
}
buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    mavenLocal()
    jcenter()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }

}
}

谁能指出我错在哪里?

您正在 android/build.gradle 中工作,但您应该在 android/src/build.gradle 中添加这些行。