user5082704
user5082704

Reputation: 71

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1

I had android studio 2.3.3 and i install android studio 3.0.1. I can't sync project

This is my error:

E:\AndroidProject\...\app\build.gradle
    Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1. Open File Show Details

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0-beta1. 
....

MY app build.gradle

    apply plugin: 'com.android.application'
            android {
        compileSdkVersion 26
        buildToolsVersion '26.0.2'
        defaultConfig {
            applicationId "com.avana.xxx"
            minSdkVersion 14
            targetSdkVersion 26
           ...
        }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
    compile 'com.android.support:appcompat-v7:26.0.0-beta1'
    compile 'com.android.support:cardview-v7:26.0.0-beta1'
    compile 'com.android.support:design:26.0.0-beta1'
}

build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

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

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

gradle.wrapper

  distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

Upvotes: 7

Views: 12633

Answers (2)

Ramkesh Yadav
Ramkesh Yadav

Reputation: 1087

Just change in build.gradle (Project: testApp),

Just follow the sequence and you are done, you need to add google in repositories and also in allprojects repositories, Sequentially, don't forget to add "task clean(..){..}"

// 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.1.2'

    }
}

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

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

Upvotes: 0

Zacks
Zacks

Reputation: 41

Goto setting->build->gradle and then uncheck offline-work button. Then rebuild you program.

Here's the same problem as yours

Upvotes: 4

Related Questions