android studion 3.4.2 gradle项目同步失败错误,无法解决依赖关系错误?

时间:2019-07-13 13:39:55

标签: android gradle

我刚刚安装了android studio 3.4.2,并创建了一个空的活动项目,但是当我尝试制作apk文件或构建项目时,我遇到了其他错误,请帮忙,我尝试了很多方法,但是我不明白是什么问题是,我没有添加任何代码,只想建立一个默认项目。但是android studio无法同步

    ERROR: Failed to resolve: androidx.constraintlayout:constraintlayout:2.0.0-beta2
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.annotation:annotation:1.1.0
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.core:core:1.1.0-rc01
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.cursoradapter:cursoradapter:1.0.0
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.fragment:fragment:1.1.0-rc01
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.appcompat:appcompat-resources:1.1.0-rc01
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.drawerlayout:drawerlayout:1.0.0
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.collection:collection:1.0.0
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: appcompat
Affected Modules: app

ERROR: Failed to resolve: androidx.test:runner:1.3.0-alpha01
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: androidx.test.espresso:espresso-core:3.3.0-alpha01
Show in Project Structure dialog
Affected Modules: app
---------------------------------------
build.gradle Module value is the default content of android studio 3.4.2
build.gradle project value is the default content of android studio 3.4.2

我不明白为什么android studio无法建立其默认设置项目。?

2 个答案:

答案 0 :(得分:0)

要解决此问题,您需要检查以下步骤:

1-确保您的gradle.build(Project)包含:

  allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url 'http://maven.google.com'
        }

    }
}

2-和build.gradle(module)在依赖项中包含此行:

implementation "com.android.support:support-core-utils:28.0.0"

答案 1 :(得分:0)

C:\ Users \ EmdadSystem.gradle \ caches 删除文件夹缓存,然后重试同步gradle