我刚刚开始使用Flutter,但是在运行默认项目时遇到了问题。我已经运行了 flutter医生,一切都很好,但是当我运行 flutter run 时,出现了gradle错误,提示“失败:构建失败,并出现异常。”
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
这是我的build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我不确定发生了什么,因为一切几乎都是开箱即用的,但是任何帮助都将不胜感激。我还尝试了flutter升级,并且一切都是最新的。