我正在学习android studio,并试图从一个新项目开始,但我遇到了一些依赖性问题
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download core.aar (androidx.core:core:1.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download core.aar (androidx.core:core:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download collection.jar (androidx.collection:collection:1.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download collection.jar (androidx.collection:collection:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download lifecycle-runtime.aar (androidx.lifecycle:lifecycle-runtime:2.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download lifecycle-runtime.aar (androidx.lifecycle:lifecycle-runtime:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download lifecycle-common.jar (androidx.lifecycle:lifecycle-common:2.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download lifecycle-common.jar (androidx.lifecycle:lifecycle-common:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download core-common.jar (androidx.arch.core:core-common:2.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download core-common.jar (androidx.arch.core:core-common:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.0)
<a href="Unable to resolve dependency for ':app@debug/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.test.ext:junit:1.1.0.
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.test.ext:junit:1.1.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.test.espresso:espresso-core:3.1.1.
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.test.espresso:espresso-core:3.1.1.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download core.aar (androidx.core:core:1.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download core.aar (androidx.core:core:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download collection.jar (androidx.collection:collection:1.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download collection.jar (androidx.collection:collection:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download lifecycle-runtime.aar (androidx.lifecycle:lifecycle-runtime:2.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download lifecycle-runtime.aar (androidx.lifecycle:lifecycle-runtime:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download lifecycle-common.jar (androidx.lifecycle:lifecycle-common:2.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download lifecycle-common.jar (androidx.lifecycle:lifecycle-common:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download core-common.jar (androidx.arch.core:core-common:2.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download core-common.jar (androidx.arch.core:core-common:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.0)
<a href="Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.fragment:fragment:1.0.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.versionedparcelable:versionedparcelable:1.0.0.">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download core.aar (androidx.core:core:1.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download core.aar (androidx.core:core:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download collection.jar (androidx.collection:collection:1.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download collection.jar (androidx.collection:collection:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download lifecycle-runtime.aar (androidx.lifecycle:lifecycle-runtime:2.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download lifecycle-runtime.aar (androidx.lifecycle:lifecycle-runtime:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download lifecycle-common.jar (androidx.lifecycle:lifecycle-common:2.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download lifecycle-common.jar (androidx.lifecycle:lifecycle-common:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download core-common.jar (androidx.arch.core:core-common:2.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download core-common.jar (androidx.arch.core:core-common:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download lifecycle-viewmodel.aar (androidx.lifecycle:lifecycle-viewmodel:2.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.0)
<a href="Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.0)">Show Details</a>
Affected Modules: <a href="openFile:C:/Users/ihass/AndroidStudioProjects/MyApplication3/app/build.gradle">app</a>
-
尝试以下步骤:禁用Gradle脱机工作设置。
转到文件->其他设置->默认设置->构建、执行、部署->构建工具->分级->取消选中脱机工作选项。
-
按照谷歌构建你的第一个应用程序链接,一步一步走。
链接1:https://developer.android.com/training/basics/firstapp
链接2:https://www.androidauthority.com/android-studio-tutorial-beginners-637572/
如果您不想将appcompat库用于临时用途,则可以解决此问题:实现"androidx.appcompat:appcompat:1.1.0"只要去掉这条线。
尝试重新安装依赖项,查看Android入门页面:https://developer.android.com/training/basics/firstapp访问创建Android项目。在你的情况下,你只需要一个好的正确设置。此时不要绕过步骤。