在Android Studio上打开我的Kotlin项目时遇到问题。我该怎么办才能解决问题?我收到的错误日志是:
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.3.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2.
Show Details
Affected Modules: app
...
...
答案 0 :(得分:0)
转到File->Settings->Build, Execution, Deployment->Build Tools->Gradle
,然后取消选中Offline work
选项。点击“应用并确定”。再次同步gradle.build
文件。
如果错误仍然存在,请转到File->Invalidate Caches/Restart
,然后从对话框中选择Invalidate and Restart
。
如果在同步库文件时仍然存在任何问题,请检查下面的maven
部分是否与项目级build.gradle
文件中的下面部分相同:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}