阅读更多
按官网配置好环境后,运行例子,会出现
Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
timeout waiting for the application to start
原因,google(),jcenter()连接不上,改为阿里镜像
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'
}
}
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' }
}
}
\flutter\packages\flutter_tools\gradle\flutter.gradle 同样替换
可正常运行
出现
Error waiting for a debug connection: ProcessException: adb did not report forwarded port
Command: D:/Android/sdk\platform-tools\adb -s emulator-5556 forward tcp:0 tcp:42536
Error launching application on Android SDK built for x86 64.
需要下载或者升级项目匹配Android SDK,在Setting,Android SDK 中可找到
进入sdk目录下的 tools 文件夹
执行android update sdk -t platform-tool --no-ui
问题解决