用Android Studio问题启动Flutter
我想在设备上运行hello world应用程序,但运行该应用程序时出现同步错误。
I want to run my hello world app on a device but when I run this app I catch errors in syncing .
我不知道如何解决该问题。我已经完成了启动应用程序的所有工作,例如在系统变量中下载SDK或PATH,但最后一步却无法正常工作。我的flutter SDK是它的最新版本。
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.
这是我的flutter-tools / flutter.gradle文件(默认)
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
}
}
.
.
.
这是日志
* 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
问题是gradle无法同步和下载依赖项。
如果您居住在伊朗,请使用代理服务器或vpn
我的建议是将您的DNS更改为 178.22.122.100和 185.51.200.2(shecan.ir)
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)