flutter SDK 及Android Studio插件的安装都是参照flutter的介绍和环境搭建(超详细)来进行的,flutter doctor一切正常。但新建flutter project后,运行就卡住了。
备注:
Dart version 2.8.2
Android Studio (version 3.6)
Flutter version 1.17.1
Running Gradle task 'assembleDebug'...
This is taking an unexpectedly long time.
运行时会卡在Running Gradle task ‘assembleDebug’…, 因为Gradle的Maven仓库在国外, 可以使用阿里云的镜像地址。
具体报错如下,环境什么的 都OK
* What went wrong:
Execution failed for task ':flutter:javaPreCompileDebug'.
> Could not resolve all files for configuration ':flutter:debugCompileClasspath'.
> Could not find io.flutter:flutter_embedding_debug:1.0.0-5b952f286fc070e99cf192775fa5c9dfe858b692.
Required by:
project :flutter
> Could not find io.flutter:arm64_v8a_debug:1.0.0-5b952f286fc070e99cf192775fa5c9dfe858b692.
Required by:
project :flutter
> Could not find io.flutter:x86_debug:1.0.0-5b952f286fc070e99cf192775fa5c9dfe858b692.
Required by:
project :flutter
> Could not find io.flutter:x86_64_debug:1.0.0-5b952f286fc070e99cf192775fa5c9dfe858b692.
Required by:
project :flutter
环境如下
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18362.836], locale zh-CN)
• Flutter version 1.17.1 at D:\SoftWare\Java\flutter
• Framework revision f7a6a7906b (7 days ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at D:\SoftWare\Java\Android\Sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = D:\SoftWare\Java\Android\Sdk
• Java binary at: D:\SoftWare\Java\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.6)
• Android Studio at D:\SoftWare\Java\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
• IntelliJ at D:\SoftWare\Java\IntelliJ IDEA
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[√] Connected device (1 available)
• Redmi 6 • 150496647d2a • android-arm • Android 9 (API 28)
! Doctor found issues in 2 categories.
第一种解决办法:
在flutterSDK文件目录打开这个文件 flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle添加
repositories {
google()
jcenter()
maven {
url "https://storage.proxy.ustclug.org/download.flutter.io"
}
maven {
url 'http://download.flutter.io'
}
}
添加库
maven {
url 'http://download.flutter.io'
}
第二种就是在本地项目:
//应用下面maven远程仓库
//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' }
maven {
url 'http://download.flutter.io'
}
或者采用第三种下面的方法:Flutter Maven repository should support HTTPS
flutter\packages\flutter_tools\gradle 目录下面的文件夹 flutter.gradle文件 MAVEN_REPO修改maven远程仓库修改
//private static final String MAVEN_REPO = "https://storage.proxy.ustclug.org/download.flutter.io";
private static final String MAVEN_REPO = "http://download.flutter.io";//修改之后
不管是第一种方案还是第三种方案 都解决了我的问题,感谢指正。
有什么好的解决方法欢迎留言一起交流。书到用时方恨少,纸上得来终觉浅。共勉。
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/114973.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...