You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Gradle同步失败:无法解析android.arch.core:common:1.1.0依赖

Fix "Failed to resolve: common (android.arch.core:common:1.1.0)" Error

Let's break down what's causing this issue and how to fix it quickly:

Why this happens

The android.arch.core:common:1.1.0 dependency is part of Android's Architecture Components, which are hosted in Google's official Maven repository. Looking at your project-level build.gradle, your allprojects section doesn't include the google() repository—only jcenter and a third-party repo. That's why Gradle can't locate the jar even after searching jcenter.

Step-by-step fix

  1. Update your project-level build.gradle
    Open the root build.gradle file and add google() to the repositories block inside allprojects. Here's the corrected version:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            jcenter()
            mavenCentral()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
            classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
            classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
            classpath "io.realm:realm-gradle-plugin:3.7.2"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.41"
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google() // Add this line first
            jcenter()
            maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
        }
    }
    

    Pro tip: Putting google() first helps resolve dependencies faster since it's the official source for Android core components.

  2. Optional: Add google() to your app module's repositories
    If the above fix doesn't work immediately, you can also add google() to the repositories block in your app's build.gradle to ensure the module can access the repo directly:

    repositories {
        google()
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }
    
  3. Clean and sync your project

    • Click File > Sync Project with Gradle Files in Android Studio.
    • If errors persist, try cleaning the project: Build > Clean Project, then sync again.
    • For stubborn cache issues, delete the .gradle/caches folder in your project directory and restart Android Studio.

Additional checks

  • Confirm your Gradle version (3.1.2) is compatible with the Android Plugin you're using—3.1.2 works perfectly with Architecture Components 1.1.0.
  • If you're behind a proxy, ensure Android Studio is configured to access external repositories correctly.

内容的提问来源于stack exchange,提问作者MrRobot9

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:35:34