android studio运行项目时,一直停在Running Gradle task 'assembleDebug'...,网上查了一下,应该是编译时需要请求部分资源,因资源链接无法访问造成的。
打开flutter\packages\flutter_tools\gradle\flutter.gradle文件,将
repositories {
google()
mavenCentral()
}
改为
repositories {
// google()
// mavenCentral()
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' }
}
再将
private static final String DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";
改为
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
打开flutter\packages\flutter_tools\gradle\resolve_dependencies.gradle文件,将
String storageUrl = System.getenv('FLUTTER_STORAGE_BASE_URL') ?: "https://storage.googleapis.com"
改为
String storageUrl = System.getenv('FLUTTER_STORAGE_BASE_URL') ?: "https://storage.flutter-io.cn"
保存,重启android studio后,就可以正常在虚拟机中运行项目了。