欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

flutter 配置问题

程序员文章站 2022-07-11 12:00:12
...
按官网配置好环境后,运行例子,会出现
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
问题解决
相关标签: flutter android