如何修复构建失败,出现异常

时间:2018-12-27 16:12:04

标签: react-native react-native-android

有人可以帮助我解决这个错误吗?

失败:构建失败,并出现异常。

1 个答案:

答案 0 :(得分:0)

尝试以此替换您的android / build.gradle,即在您的项目级gradle中以此

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

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

allprojects {
    repositories {
        mavenLocal()
        maven {url "https://maven.google.com"} //<---- this should be added and should be aboce jcenter
        maven {url "$rootDir/../node_modules/react-native/android"}
        jcenter()
    }
}

在那之后清除您的gradle从cmd / terminal进入android文件夹 gradlew清洁 然后运行react native应用程序