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

新建Android项目编译报错:无法找到common.jar (android.arch.core:common:1.1.0)

Fixing "Could not find common.jar (android.arch.core:common:1.1.0)" Error

Hey there! Let's get this issue sorted out step by step— I know how frustrating build errors can be when you're just starting a new project.

What's Causing This Error?

There are two key reasons you're hitting this problem:

  1. JCenter is deprecated: The jcenter() repository you're using has been discontinued, and many official Android libraries (including android.arch.core:common:1.1.0) are no longer hosted there.
  2. Outdated Gradle Plugin: Your Gradle plugin version 2.2.2 is extremely old. It doesn't support modern Android repository structures or newer library dependencies like the Architecture Components you're trying to use.

Step-by-Step Solutions

1. Update Your Root build.gradle

Replace your root-level build.gradle with this updated version. We'll switch to active, supported repositories and upgrade the Gradle plugin to a stable, modern version:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        // Use a supported, up-to-date Gradle plugin
        classpath 'com.android.tools.build:gradle:7.4.2'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Note: After making this change, Android Studio will likely prompt you to update the Gradle wrapper—just click "Update" to let it handle that automatically.

2. Verify Your App Module's build.gradle

Make sure your app-level build.gradle has compatible SDK settings and uses modern dependency syntax. Here's a baseline example to reference:

apply plugin: 'com.android.application'

android {
    compileSdk 33
    defaultConfig {
        applicationId "com.yourpackage.name"
        minSdk 21
        targetSdk 33
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // Use AndroidX libraries (the modern replacement for old android.arch packages)
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
}

3. Sync and Clean Your Project

  • Click the Sync Project with Gradle Files button (the elephant icon in Android Studio's toolbar).
  • Go to Build > Clean Project, then Build > Rebuild Project.
  • If issues persist, delete the .gradle folder in your project root and re-sync to clear cached data.

Your Project Creation Screenshots

Here are the setup screenshots you shared:
Creating an android project 1
Creating an android project 2
Creating an android project 3
Creating an android project 4

Original Configuration for Reference

Your original root build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Your original settings.gradle:

include ':app'

内容的提问来源于stack exchange,提问作者G. Ciardini

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 07:41:14