【问题标题】:Starting Flutter With Android Studio problems使用 Android Studio 问题启动 Flutter
【发布时间】:2020-07-17 00:27:16
【问题描述】:

我想在设备上运行我的 hello world 应用,但是当我运行这个应用时,我发现同步错误。

我不知道如何解决它。我已经完成了启动应用程序的所有工作,例如在系统变量中下载 SDK 或 PATH,但它在最后一步不起作用,我的颤振 SDK 是它的最后一个版本。

这是我的 flutter-tools/flutter.gradle 文件(默认)

.
.
.
.
buildscript {
   repositories {
       google()
       jcenter()
   }
   dependencies {
       classpath 'com.android.tools.build:gradle:3.5.0'
   }
}

android {
   compileOptions {
       sourceCompatibility 1.8
       targetCompatibility 1.8
   }
}

.
.
.

这是日志


* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not find fragment.jar (androidx.fragment:fragment:1.0.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.0.0/fragment-1.0.0.jar
   > Could not find lifecycle-runtime.jar (androidx.lifecycle:lifecycle-runtime:2.0.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-runtime/2.0.0/lifecycle-runtime-2.0.0.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 50s
Finished with error: Gradle task assembleDebug failed with exit code 1

【问题讨论】:

  • 和颤振医生表明一切都很好

标签: android android-studio flutter gradle dart


【解决方案1】:

您的问题是 gradle 无法同步和下载依赖项。 如果您住在伊朗,请使用代理或 vpn 我的建议是将您的 dns 更改为“178.22.122.100”和“185.51.200.2”(shecan.ir)

【讨论】:

  • 使用另一个 gradle 版本,比如 3.6.2 可能会有所帮助
  • @mostafa_ksh78 yes 在浏览器中会显示 404。但如果您使用 shecan.ir 并设置 dns,则 gradle 同步成功。我像你一样测试了准确的颤振 gradle 设置并构建了 okey
  • @mostafa_ksh78 是的,没问题
  • @mostafa_ksh78 设置 dns 后,禁用您的网络接口并再次启用它可能会有所帮助,在没有其他 vpn 和代理的情况下设置 dns 后检查一些 google android 开发人员,如浏览器中的 developer.android.com/reference/android/telephony/SmsManager 可能会毫无问题地打开跨度>
  • 我可以打开这个页面但是同样的问题
猜你喜欢
  • 2020-03-06
  • 1970-01-01
  • 1970-01-01
  • 2021-07-19
  • 1970-01-01
  • 2021-07-13
  • 2021-10-15
  • 1970-01-01
  • 2020-06-04
相关资源
最近更新 更多