Failed to resolve: com.android.support:design-v7:27.1.1

前端 未结 6 1713
故里飘歌
故里飘歌 2021-01-19 06:09

I am using Android Studio 3.1.3. Gradle build sync failed. I used following method but there is no use of it. If there is any solution please tell me

相关标签:
6条回答
  • 2021-01-19 06:50

    Don't

     implementation 'com.android.support:design-v7:27.1.1'
     buildToolsVersion '27.1.1'
    

    Do

    implementation 'com.android.support:design:27.1.1'
    buildToolsVersion '27.0.3'
    

    Make sure, you added below

        allprojects {
            repositories {
                google()
                jcenter()
                maven { url 'https://maven.google.com/' }
    
            }
        }
    

    Then Clean-Rebuild-Build.

    0 讨论(0)
  • 2021-01-19 06:52

    First make sure that you using:

    targetSdkVersion 27
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    

    And your gradle be like:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
    
        repositories {
            google()
            //..
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.3'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            //..
        }
    }
    

    And also update design implementation like below:

    implementation 'com.android.support:design:27.1.1'
    

    You get this error because com.android.support:design-v7 does not exist it exist without -v7, also you can check support libraries in this link any time to make sure you are using the correct library.

    0 讨论(0)
  • 2021-01-19 06:53

    this is the correct form
    implementation 'com.android.support:design:27.1.1'

    0 讨论(0)
  • 2021-01-19 06:54

    Add the maven URL in all projects section as well and sync the gradle or try removing one by one external libraries and sync the gradle hope it helps

    allprojects { repositories { google() jcenter()maven :"http://www.google.com" } }
    
    0 讨论(0)
  • 2021-01-19 07:01

    Upgrade to Android Studio 3.3 destroyed all my projects.

    This was one of the problems today I ran into. And after wasting too much time to find a solution, here is the working gradle. By the time I fixed this, I had forgotten what actually I was working on. I really wonder why Google always ship their Android Studio with broken gradle files. Seems like Google engineers even themselves don't know how to write proper gradle, and nobody QAs Android Studio before its final release.

    Module level gradle:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
    
        defaultConfig {
            applicationId "com.journaldev.okhttp"
            minSdkVersion 25
            targetSdkVersion 27
            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:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        implementation 'com.android.support:design:27.1.1'
        testImplementation 'junit:junit:4.12'
        implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
        implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    }
    

    And the project level gradle:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.3.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://maven.google.com/' }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    0 讨论(0)
  • 2021-01-19 07:06

    You should add google() repository to your dependencies

    allprojects {
        repositories {
           google()
           jcenter() 
        }
    }
    
    0 讨论(0)
提交回复
热议问题