简体   繁体   English

无法解决:Android Studio中的com.android.support:design:26.2.0错误

[英]Failed to resolve: com.android.support:design:26.2.0 error in Android Studio

I am trying to follow a tutorial and it asks us to clone a project from GitHub. 我正在尝试遵循一个教程,它要求我们从GitHub克隆项目。 I have done this but when it runs in my Android Studio, I get two errors, 我已经做到了,但是当它在我的Android Studio中运行时,出现两个错误,

failed to resolve 'com.android.support:design:26.2.0'
failed to resolve 'com.android.support:appcompat-v7:26.2.0'

I have looked this up on Stackoverflow and seems a common question, but I don't seem to be able to get it to work. 我在Stackoverflow上进行了查找,这似乎是一个常见问题,但是我似乎无法使其正常工作。

my current gradle files look like this, 我当前的gradle文件看起来像这样,

module gradle file, 模块gradle文件,

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.android.emojify"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:appcompat-v7:25.2.0'
    testCompile 'junit:junit:4.12'
}

I know the sdkVersion needs changing as it says cannot be lower than 26, but I have reset to what was initially imported from github. 我知道sdkVersion需要更改,因为它说不能低于26,但是我已重置为最初从github导入的内容。

project gradle, 项目摇篮,

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {

        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

When I change the sdk etc to 26 I get the error, 当我将SDK等更改为26时,出现错误,

Failed to resolve: com.android.support:design:26.2.0 无法解决:com.android.support:design:26.2.0

Failed to resolve: com.android.support:appcompat-v7:26.2.0 无法解决:com.android.support:appcompat-v7:26.2.0

I have read on here about adding in, 我在这里阅读了有关添加的内容,

maven {
    url "www.maven.google.com"
}

This doesn't seem to make any difference though.

Failed to resolve: com.android.support:design:26.2.0 无法解决:com.android.support:design:26.2.0

Failed to resolve: com.android.support:appcompat-v7:26.2.0 无法解决:com.android.support:appcompat-v7:26.2.0

It's simply because the last version of support library 26 is version 26.1.0 . 这仅仅是因为支持库26的最新版本是26.1.0版。 You better to use support library version 28.0.0 or either upgrading to AndroidX. 您最好使用支持库版本28.0.0或升级到AndroidX。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解决:Android Studio中的com.android.support:design:27 - Failed to resolve: com.android.support:design:27 in android studio 无法解决:com.android.support:design-v7:25.3.1 - Failed to resolve: com.android.support: design-v7:25.3.1 错误:(30,18)无法解决:com.android.support:design-v7:25.3.1 - Error:(30, 18) Failed to resolve: com.android.support:design-v7:25.3.1 Android Studio <Failed to resolve: com.android.support:appcompat-v7:28.0.0> - Android Studio <Failed to resolve: com.android.support:appcompat-v7:28.0.0> 无法解析:com.android.support:support-v4:30.0.0 - Failed to resolve: com.android.support:support-v4:30.0.0 无法解析:com.android.support:support-v4:26.0.2 - Failed to resolve: com.android.support:support-v4:26.0.2 Android Studio无法解决:com.android.support:appcompat-v7.28.0.0 - Android Studio Failed to resolve: com.android.support:appcompat-v7.28.0.0 无法解决:com.android.support:cardview-v7:24.2.0 - Failed to resolve: com.android.support:cardview-v7:24.2.0 错误:无法解决:com.android.support:mediarouter-v7:23.4.0 - ERROR: Failed to resolve: com.android.support:mediarouter-v7:23.4.0 Android Studio Gradle无法找到&#39;com.android.support:design:22.2.0&#39;(Android设计支持库) - Android Studio Gradle cannot find 'com.android.support:design:22.2.0' (the Android Design Support Library)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM