Flutter踩坑集锦

  1. 开发环境: Ubuntu 18.04.1 LTS
  2. Could not resolve all files for configuration 'classpath'. [1]
    • 配置Android下的build.gradle
// Generated file. Do not edit.

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' }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

  • 配置flutter sdk中的flutter.gradle

找到fluttersdk目录,进入如下目录Flutter⁩ ▸ ⁨packages⁩ ▸ ⁨flutter_tools⁩ ▸ ⁨gradle⁩找到下 flutter.gradle文件

buildscript {
    repositories {
        //google()
        //jcenter()
        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'
    }
}


2.Flutter install get 失败
添加Flutter阿里镜像到环境变量[2]

sudo vim /etc/profile

将以下内容[3]添加以下到文件中

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn


参考:
[1] https://blog.csdn.net/hello_json/article/details/83515278
[2] https://blog.csdn.net/White_Idiot/article/details/78253004
[3] https://flutterchina.club/setup-linux/

你可能感兴趣的:(Flutter踩坑集锦)