-1

Newly I Installed Android studio 3.0.1, and attempt to run a simple "Hello World" project in first Common step of Gradle Project sync I faced with This Error and it faild : Could not resolve com.android.support:appcompat-v7:26.0.1. It seem its also common error that's cause of Maven And should be resolve with adding code below in the build.gradle project file as it said in https://developer.android.com/topic/libraries/support-library/setup.html

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

Here's my top level build.gradle file:

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    // 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
}

And here's my app/build.gradle file:

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.example.renayati.myapplication2"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary= true
}
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:26.0.1'
    implementation 'com.android.support:design:26.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-vector-drawable:26.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}  

I also

1.removed gradle from my project root folder and rebuild the project again, but it didn't work...

2.commented these 3 lines below, but still the same error message.

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'

didn't work...

I searched more but I just catch same answers. Is anyone here to help me?

AtiRayan
  • 11
  • 3
  • Possible duplicate of [Failed to resolve: com.android.support:appcompat-v7:26.0.0](https://stackoverflow.com/questions/45357000/failed-to-resolve-com-android-supportappcompat-v726-0-0) – ADM Dec 05 '17 at 08:53

1 Answers1

0

put buildToolsVersion "26.0.1" below compileSdkVersion in gradle build. and download the 26.0.1 repository

Kapil Parmar
  • 881
  • 8
  • 19