- 如果你之前没有运行过Android 项目那么你可能缺少很多依赖工具等
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
Install the missing components using the SDK manager in Android Studio.
- 解决方法很简单, 打开Android项目让AS自动下载依赖工具等
- 打开项目后点击运行或者右上角出现tryagain(点击)自动下载
- 没有运行按钮的情况
// 配置阿里镜像
buildscript {
repositories {
// google()
// jcenter()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
// 全局配置阿里镜像
allprojects {
repositories {
// google()
// jcenter()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
}
}
- 直到项目可以运行
运行成功后关闭项目, 回到之前的Flutter 项目, 再次运行发现之前的报错都没了