behrooz
behrooz

Reputation: 638

android studio gradle can't resolve appcompat-v7:27.0.2

I was faced with a strange problem.

I'm using android studio 3.0.1 . the latest appcompat version that grade resolve is appcompat:v7:26.0.0_alpha1

build.gradle (module: app)

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "someID"
        minSdkVersion 16
        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'
        }
    }
    sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/helpers'] } }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    })

    // Support v7
    //compile  'com.android.support:appcompat-v7:26.+'
    compile "com.android.support:support-core-utils:27.0.2"
    compile 'com.android.support:appcompat-v7:27.0.2'
    // JSON Parsing
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    // Retrofit
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    //testCompile 'junit:junit:4.12'
}

and this is build.gradle(Project)

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

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

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

i got errors like

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:support-core-utils:27.0.2.

i'm using proxy and i can get previous releases till v:26.0.0_alpha1

ps:i tried compile 'com.android.support:appcompat-v7:27.+'" and clean project

Upvotes: 3

Views: 2787

Answers (2)

user6419437
user6419437

Reputation:

Here is how to fix it.

Go Tools > SDK Manager. If it is showing that Android 8.1 (Oreo) is partially installed, click on show package details in the bottom right corner.

Under Android 8.1 (Oreo) select Sources for Android 27 and click on the Download icon on its left margin.

Click Ok and Android studio will install sources for Android 27 and then try to build the project again.

Good Luck!

Upvotes: 1

behrooz
behrooz

Reputation: 638

OK i changed my vpn server and everything build ok

I think they block the other vpn service ips !

Upvotes: 4

Related Questions