问题
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