Littleor

785 分类: 闲语

Flutter 踩坑记录

前言

本文是咱初学Flutter时记录一些学习历程的文章,主要记录碰到的坑来分享给大家,避免大家踩坑.

Gradle Resolving dependencies Error

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/Users/rabbit/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.

当我第一次运行 flutter run 的时候就碰到了这个问题-Android Studio一直卡在创建的界面.
回来谷歌一圈发现是因为我们被墙了,无法访问到google的源
解决办法:

修改Flutter目录下的/packages/flutter_tools/gradle/flutter.gradle 
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.2.1'
    }
}

然后再 flutter run 即可

#none

作者: Littleor

版权: 除特别声明,均采用BY-NC-SA 4.0许可协议,转载请表明出处

目录Content

评论