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

20,800

Solution 1

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.

Solution 2

You should add google() repository to your dependencies

allprojects {
    repositories {
       google()
       jcenter() 
    }
}

Solution 3

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.

Share:
20,800
amol junghare
Author by

amol junghare

Updated on July 09, 2022

Comments

  • amol junghare
    amol junghare almost 2 years

    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

    1. maven { url "https://maven.google.com" }

    2. Invalidate restart & caches

    3. multiDexEnabled true

    4. Adding mavenLocal() and mavenCentral()

      This is module level build.gradle file:

      android {
              compileSdkVersion 27
              defaultConfig {
                  applicationId "com.developers.a_g.designapp"
                  minSdkVersion 15
                  targetSdkVersion 27
                  buildToolsVersion '27.1.1'
                  versionCode 1
                  versionName "1.0"
                  multiDexEnabled true
                  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'])
          implementation 'com.android.support:appcompat-v7:27.1.1'
          implementation 'com.android.support.constraint:constraint-layout:1.1.2'
          testImplementation 'junit:junit:4.12'
          androidTestImplementation 'com.android.support.test:runner:1.0.2'
          androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
          implementation 'com.android.support:cardview-v7:27.1.1'
          implementation 'com.android.support:design-v7:27.1.1'
          implementation 'com.rengwuxian.materialedittext:library:2.1.4'
          implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
          implementation 'com.github.d-max:spots-dialog:0.7@aar'
          implementation 'com.squareup.retrofit2:retrofit:2.3.0'
          implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
      }
      
      
       android {
              compileSdkVersion 27
              defaultConfig {
                  applicationId "com.developers.a_g.designapp"
                  minSdkVersion 15
                  targetSdkVersion 27
                  buildToolsVersion '27.1.1'
                  versionCode 1
                  versionName "1.0"
                  multiDexEnabled true
                  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'])
          implementation 'com.android.support:appcompat-v7:27.1.1'
          implementation 'com.android.support.constraint:constraint-layout:1.1.2'
          testImplementation 'junit:junit:4.12'
          androidTestImplementation 'com.android.support.test:runner:1.0.2'
          androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
          implementation 'com.android.support:cardview-v7:27.1.1'
          implementation 'com.android.support:design-v7:27.1.1'
          implementation 'com.rengwuxian.materialedittext:library:2.1.4'
          implementation 'com.szagurskii:patternedtextwatcher:0.5.0'
          implementation 'com.github.d-max:spots-dialog:0.7@aar'
          implementation 'com.squareup.retrofit2:retrofit:2.3.0'
          implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
      }
      

    This is project level build.gradle file:

        buildscript {
    
            repositories {
    
                jcenter()
                google()
    
    
                maven {
                    url "https://maven.google.com"
                }
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.1.3'
            }
        }
    
        allprojects {
            repositories {
                google()
                jcenter()
            }
        }
    
        task clean(type: Delete) {
            delete rootProject.buildDir
        }
    
  • amol junghare
    amol junghare almost 6 years
    now it says failed to find build tools revision 27.1.1 & All packages are not available for download! The following packages are not available: - Package id build-tools;27.1.1
  • IntelliJ Amiya
    IntelliJ Amiya almost 6 years
    @amoljunghare use buildToolsVersion '27.0.3'
  • Paraskevas Ntsounos
    Paraskevas Ntsounos almost 6 years
    change also buildToolsVersion '27.0.3'
  • IntelliJ Amiya
    IntelliJ Amiya almost 6 years
    @amoljunghare Solved this yet??
  • Paraskevas Ntsounos
    Paraskevas Ntsounos almost 6 years
    @amoljunghare just remove -v7 from com.android.support:design, you get this error because com.android.support:design-v7 does not exist it exist without -v7, also update build tools to 27.0.3 and it will be fixed