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

Android Gradle同步失败:找不到support-core-ui.aar问题求助

Gradle Sync Failed: Could not find support-core-ui.jar (com.android.support:support-core-ui:27.1.1)

Problem Description

I've been maintaining this Android project for a year, and yesterday when I opened it in Android Studio 3.1.2, Gradle sync suddenly failed and the project won't build. Here's the error message:

Could not find support-core-ui.jar (com.android.support:support-core-ui:27.1.1). Searched in the following locations: https://jcenter.bintray.com/com/android/support/support-core-ui/27.1.1/support-core-ui-27.1.1.jar Please install the Android Support Repository from the Android SDK Manager. Open Android SDK Manager

I've confirmed that the Android Support Repository is correctly installed, as other projects run without any issues.

Below is the content of the app module's gradle file:

buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.21.5' } } plugins { id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1' } apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'com.neenbedankt.android-apt' apply plugin: 'realm-android' android { compileSdkVersion 27 buildToolsVersion "27.0.3" defaultConfig { minSdkVersion 16 targetSdkVersion 23 versionCode 32 versionName "3.1" multiDexEnabled true manifestPlaceholders = [onesignal_app_id : "", // Project number pulled from dashboard, local value is ignored. onesignal_google_project_number: "REMOTE"] } configurations { all*.exclude group: 'com.android.support', module: 'support-v4' } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '27.1.1' } } if (requested.group == 'com.google.android.gms') { details.useVersion '15.0.1' } if (requested.group == 'com.google.firebase') { details.useVersion '15.0.1' } } } buildTypes { release { minifyEnabled false // proguardFiles 'proguard.cfg' } } useLibrary 'org.apache.http.legacy' packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/DEPENDENCIES' } } repositories { maven { url "https://jitpack.io" } maven { url "https://dl.bintray.com/lukaville/maven" } maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.google.com' } mavenCentral() } dependencies { compile project(':FORTSDKv1.4.1') compile files('libs/nineoldandroids-2.4.0.jar') compile files('libs/gcm.jar') compile files('libs/httpclient-4.3.4.jar') compile files('libs/httpmime-4.2.5.jar') compile files('libs/HockeySDK-3.0.2.jar') compile files('libs/samsungpay-1.8.00.jar') compile project(':library-2.4.1') // Required for geotagging compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { transitive = true } compile('com.code-troopers.betterpickers:library:3.1.0') { exclude group: 'com.nineoldandroids', module: 'library' } compile 'com.android.support:support-v4:27.0.0' // https://mvnrepository.com/artifact/com.android.support/support-core-ui compile group: 'com.android.support', name: 'support-core-ui', version: '27.1.1' compile 'com.android.support:appcompat-v7:27.0.0' compile 'com.android.support:cardview-v7:27.0.0' compile 'com.android.support:customtabs:27.0.0' compile 'com.android.support:multidex:1.0.3' compile 'com.googlecode.libphonenumber:libphonenumber:8.8.9' compile 'org.parceler:parceler-api:1.1.5' compile('com.google.android.gms:play-services-analytics:11.8.0') { exclude group: 'com.android.support', module: 'support-v4' } compile 'com.google.android.gms:play-services-maps:15.0.1' compile 'com.google.android.gms:play-services-auth:15.0.1' compile 'com.google.android.gms:play-services-gcm:15.0.1' compile 'com.google.android.gms:play-services-location:15.0.1' // compile 'com.google.android.gms:play-services-analytics:11.8.0' compile 'com.github.hackware1993:MagicIndicator:1.5.0' compile 'com.roomorama:caldroid:2.3.1' compile 'com.google.code.gson:gson:2.8.1' compile 'com.leocardz:aelv:1.1@aar' compile 'com.flaviofaria:kenburnsview:1.0.7' compile('com.jakewharton:butterknife:8.4.0') { exclude module: 'support-compat' exclude group: 'com.google.android', module: 'support-v4' } compile 'com.pixplicity.easyprefs:library:1.8.1@aar' compile 'de.hdodenhof:circleimageview:2.2.0' compile 'com.github.jrvansuita:IconHandler:+' compile 'com.github.mancj:SlideUp-Android:2.2.5' compile 'com.afollestad:sectioned-recyclerview:0.5.0' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.facebook.stetho:stetho:1.4.1' compile 'com.facebook.stetho:stetho-okhttp3:1.4.1' compile 'com.uphyca:stetho_realm:2.0.0' compile 'org.greenrobot:eventbus:3.1.1' compile 'com.birbit:android-priority-jobqueue:2.0.1' compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0'

Solutions

Let's walk through the fixes step by step— I've run into almost identical issues with old support library versions and repository ordering before, so these should help:

1. Fix Repository Priority

Looking at your repositories block, Google's Maven repo (where support libraries are hosted) is not at the top. JCenter (which is often referenced via mavenCentral) might no longer have the 27.1.1 artifact, or Gradle is checking the wrong repo first.

Update your repositories block to prioritize Google's repo and add jcenter explicitly:

repositories {
    maven { url 'https://maven.google.com' } // Move this to the top
    maven { url "https://jitpack.io" }
    maven { url "https://dl.bintray.com/lukaville/maven" }
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
    jcenter() // Add this explicitly for fallback
}

2. Resolve Support Library Version Conflicts

You've got a mix of versions: most support libraries are on 27.0.0, but support-core-ui is on 27.1.1, plus a resolution strategy forcing all support libs to 27.1.1. This mismatch is definitely causing problems.

You have two options here:

  • Update all support libraries to 27.1.1:
    Change lines like these:
    compile 'com.android.support:support-v4:27.0.0'
    compile 'com.android.support:appcompat-v7:27.0.0'
    compile 'com.android.support:cardview-v7:27.0.0'
    compile 'com.android.support:customtabs:27.0.0'
    
    To:
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.android.support:customtabs:27.1.1'
    
  • Or remove the explicit support-core-ui dependency:
    appcompat-v7 and support-v4 already include support-core-ui as a transitive dependency, so you might not need to declare it at all. Try deleting this line:
    compile group: 'com.android.support', name: 'support-core-ui', version: '27.1.1'
    

3. Clean Caches and Refresh Dependencies

Old cached artifacts can cause weird issues even after fixing configs. Do this:

  • Go to File > Invalidate Caches / Restart in Android Studio, select "Invalidate and Restart".
  • After restarting, delete the .gradle folder in your project root and the build folders in all modules.
  • Run ./gradlew clean build --refresh-dependencies from the terminal (or use Android Studio's "Clean Project" then "Rebuild Project" options).

4. Fix Google Play Services Version Mismatch

You have play-services-analytics:11.8.0 mixed with other play services at 15.0.1. This can create hidden dependency conflicts that affect support libraries. Update the analytics dependency to match:

compile('com.google.android.gms:play-services-analytics:15.0.1') {
    exclude group: 'com.android.support', module: 'support-v4'
}

5. Double-Check SDK Components

Even though you said the Support Repository is installed, it's worth verifying:

  • Open the SDK Manager, go to "SDK Tools".
  • Make sure "Android Support Repository" is installed and up to date (for API 27, you need the corresponding repository version).
  • Also confirm "Google Repository" is installed— play services depend on this.

Final Notes

After applying these changes, sync the project again. The main culprits here are almost certainly repository ordering (not checking Google's repo first) and mixed support library versions. Fixing those should resolve the missing jar error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 08:24:54