Starting Flutter With Android Studio problems

自作多情 提交于 2020-04-18 06:12:29

问题


I want to run my hello world app on a device but when I run this app I catch errors in syncing .

I don't know how to fix it. I had done every work for starting app like downloading SDKs or PATH in System variables but it doesn't work at last step my flutter SDK is last version of it.

This is my flutter-tools/flutter.gradle file (default)

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

android {
   compileOptions {
       sourceCompatibility 1.8
       targetCompatibility 1.8
   }
}

.
.
.

and this is the log


* 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

回答1:


your problem is gradle can't sync and download dependencies. if you live in Iran use proxy or vpn my suggestion is change your dns to "178.22.122.100" and "185.51.200.2" (shecan.ir)



来源:https://stackoverflow.com/questions/61035535/starting-flutter-with-android-studio-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!