React-Native 不能 运行 Android - react-native-maps:compileReleaseJavaWithJavac

React-Native can't run Android - react-native-maps:compileReleaseJavaWithJavac

我有一个 react-native 项目,在 ios 上一切正常,但是当我尝试在 android 上 运行 它时,我收到此错误 ':react-native-maps:compileReleaseJavaWithJavac' > Could not find tools.jar .我不确定这意味着什么,我做了一些研究并发现了这个 但是,这似乎不是我的情况。

有人知道这个错误是什么意思吗?

build.gradle

dependencies {
    compile project(':react-native-push-notification')
    compile project(':react-native-prompt-android')
    compile project(':react-native-maps')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    compile 'com.google.android.gms:play-services-base:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile "com.facebook.react:react-native:+"  // From node_modules
}

Android 开发需要在您的计算机上安装 JDK。您必须将环境变量 JAVA_HOME 设置为有效的 JDK。该错误可能是因为您的计算机上没有 JDK。尝试启动 Android Studio 并通过创建一个空项目来检查 JDK 是否在此处,转到 File-> Project Structure 并查看 JDK 位置。