0

Problem:
Gradle project sync failed. Basic functionality(e.g.editing,debugging) will not work properly.

Error:Unable to resolve dependency for ...compileClasspath:Could not resolve com.android.support...

Tried: Edit the build.gradle file - didn't work.
Check the offline - already disabled.
Unistall and re-install - not working.
Invalidate and restart - not working.
Turn off the antivirus - not helping.
Update to the newest gradle version - no.
Delete gradle folder and let it download again - no.
Download NDK - no.

So far I had tried the many popular ways I can get from google, but nothing is working.

The OS is windows 7. I tried to download the gradle, SDK and NDK, and AS again today and nothing is working still. I am pretty sure that they are the newest version.

google() is added, as many other websites stated. Here are my build.gradle files.

build.gradle (project)

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()
    }
}

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

build.gradle (module app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.nina.myapplication"
        minSdkVersion 23
        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'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Nina Z
  • 19
  • 4

0 Answers0