flutter-安卓端运行Could not resolve a

2019-08-19  本文已影响0人  卓敦

前阵子心血来潮学了flutter,各种环境弄好之后就运行了,在ios端运行没问题,可是在安卓端一运行就报错,报了以下错误

Finished with error: Please review your Gradle project setup in the android/ folder.
* Error running Gradle:
ProcessException: Process "/Users/../Desktop/flutter_app/android/gradlew" exited abnormally:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/../Desktop/flutter_app/android/app/build.gradle' line: 25

* 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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
  Command: /Users/../Desktop/flutter_app/android/gradlew app:properties`

解决方法:
找到放置flutter安装包的地方(注意是fluttersdk安装的地方,不是项目目录),打开flutter->packages->flutter_tools->gradle->flutter.gradle
修改内容

buildscript {
    repositories {
        google()
        mavenCentral()  //add this line
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

我是这样解决的,在此记录一下,不一定适用于所有人

上一篇下一篇

猜你喜欢

热点阅读