Flutter入门系列(六)---常见问题,持续更新ing

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chichengjunma/article/details/84630761

(1)刚建好一个demo 编译运行一个demo 控制台就出现如下情况

Launching lib/main.dart on Android SDK built for x86 in debug mode...

Initializing gradle...

Resolving dependencies...

* Error running Gradle:

ProcessException: Process "/Users/xxx/develop/android/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/xxx/develop/android/flutter_app/android/app/build.gradle' line: 25

扫描二维码关注公众号,回复: 4295751 查看本文章

* What went wrong:

A problem occurred evaluating project ':app'.

> Could not resolve all files 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/rabbit/develop/android/flutter_app/android/gradlew app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

解决办法:

​修改build.gradle,注释掉jcenter(),google()。使用阿里的镜像。原因是jcenter google库无法访问到导致的问题。
 

buildscript {

    repositories {

        //google()

        //jcenter()

        maven { url 'https://maven.aliyun.com/repository/google' }

        maven { url 'https://maven.aliyun.com/repository/jcenter' }

        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

    }



    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.2'

    }

}



allprojects {

    repositories {

        //google()

        //jcenter()

        maven { url 'https://maven.aliyun.com/repository/google' }

        maven { url 'https://maven.aliyun.com/repository/jcenter' }

        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

    }

}



猜你喜欢

转载自blog.csdn.net/chichengjunma/article/details/84630761