一.命令
创建flutter项目 flutter create
运行flutter项目 在项目的根目录flutter run -d 'iPhone X
二.运行报错
找到android目录下build.gradle,将google的源替换下
// 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' }
}
进入/Users/LYK/lykFlutter/flutter/packages/flutter_tools/gradle/flutter.gradle
修改
buildscript {
repositories {
//jcenter()
// maven {
// url 'https://dl.google.com/dl/android/maven2'
// }
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'
}
}
然后再重新Debug一下,就基本可以启动起来。
网友评论