首页 > 解决方案 > 更新 Android Studio 插件后,React Native Android 出现错误 MultipleCompilationErrorsException 启动失败

问题描述

我正在使用 Android Studio 开发 React Native App。最近 Android Studio 要求我进行一些更新,所以我点击更新了 IDE 的一些插件。

现在,当我尝试构建时出现错误:

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

我的项目结构: 变量 项目模块

我的 build.grale 内容:

buildscript {
ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
}
repositories {
    google()
    jcenter()
}
dependencies {
    classpath('com.android.tools.build:gradle:3.6.1')
    classpath 'com.google.gms:google-services:4.3.3'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

构建时如何修复错误: 在此处输入图像描述

标签: androidreact-nativegradlebuild

解决方案


这样做后修复:

rm -rf node_modules

yarn   // install react native project dependencies 

yarn cache clean

删除 .idea 项目 Android Studio

在 Android Studio 中重新打开项目并再次构建


推荐阅读