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

无法解析android.design.26.0.0与appcompat依赖的技术求助

Hey there, let’s work through this dependency resolution issue step by step — I’ve run into this exact problem multiple times, so we’ll get your build back on track in no time!

The Core Issues I Spot

Your setup has a few key problems that are causing the dependency resolution failures:

  1. Wrong Artifact ID for the Design Library
    You’re using com.google.android:design:26.0.0 for the design support library, but the correct artifact is part of the Android Support Library ecosystem: com.android.support:design:26.0.0.

  2. Missing Google Maven Repository
    Starting with Android Support Library version 26.0.0, Google moved these libraries from JCenter to their own Maven repository. Your project isn’t configured to pull from this repo, so Gradle can’t find the 26.0.0 versions.

  3. Outdated Gradle Plugin
    You’re using Android Gradle Plugin 2.3.3, which doesn’t support compiling against SDK 26. You need to upgrade the plugin to a version that’s compatible with your target SDK.

  4. Firebase UI Version Mismatch
    Firebase UI 1.2.0 is built to work with Android Support Library 25.x, not 26.x. This will cause version conflicts even if you fix the other issues.


Step-by-Step Fixes

1. Update Your Project-Level build.gradle

Add the Google Maven repository to both the buildscript and allprojects sections, and upgrade the Gradle plugin and Google Services plugin:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        google() // Add this to access Google's Gradle plugins
    }
    dependencies {
        // Upgrade to a plugin version that supports SDK 26
        classpath 'com.android.tools.build:gradle:3.0.1'
        // Upgrade Google Services to match the plugin version
        classpath 'com.google.gms:google-services:3.1.0'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google() // Critical for accessing Android Support Library 26+
        maven { url 'https://maven.fabric.io/public' }
    }
}

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

2. Fix Your Module-Level build.gradle

Correct the design library dependency, update versions to be compatible, and switch to modern dependency syntax (replace compile with implementation):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2" // Use a more recent build tools version for SDK 26
    defaultConfig {
        applicationId "com.example.amirqadir.finalchat"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0' // Corrected dependency
    implementation 'com.android.support.constraint:constraint-layout:1.1.3' // Updated constraint layout
    
    testImplementation 'junit:junit:4.12'
    
    // Use Firebase UI version compatible with Support Library 26.1.0
    implementation 'com.firebaseui:firebase-ui:2.3.0'
}

// Don't forget to apply the Google Services plugin at the end!
apply plugin: 'com.google.gms.google-services'

3. Update Gradle Wrapper Version

Open gradle/wrapper/gradle-wrapper.properties and update the distribution URL to match the Gradle plugin version you’re using (Gradle 4.1 works with plugin 3.0.1):

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

Final Steps to Apply the Fixes

  1. Save all your modified files.
  2. Click Sync Now in Android Studio when prompted.
  3. If you still see errors, go to Build > Clean Project followed by Build > Rebuild Project.

This should resolve the dependency resolution issues you’re facing. The key was adding the Google Maven repo and fixing the mismatched versions across your dependencies.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 03:38:42