0

So, I built an app using targetSdkVersion 25, but then I realized that it's necessary to be higher than 26. I tried to upgrade it to API 27 and I am getting this error:

Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:27.0.0

Under this message there are three options:

  • Install Repository and sync project
  • Show in File Show in Project
  • Structure dialog

My build.gradle(Project):

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

My build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.simon.onequoteaday"
        minSdkVersion 14 //9
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-ads:11.0.0'
    compile 'com.android.support:appcompat-v7:27.1.1'
}

I've also installed all API 27 SDK. Any possible solutions? Thank you

Edit: I've already used the solution provided by other threads but they don't solve my problem. I think my problem is different.

Simon Iyamu
  • 81
  • 1
  • 6
  • Possible duplicate of https://stackoverflow.com/questions/47164768/failed-to-resolve-com-android-supportappcompat-v727-dependency-error – redlabrat Aug 08 '18 at 14:30
  • Possible duplicate of [Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)](https://stackoverflow.com/questions/47164768/failed-to-resolve-com-android-supportappcompat-v727-dependency-error) – Martin Zeitler Aug 08 '18 at 15:44

3 Answers3

0

Change

    buildtoolsversion '27.0.0'

and dependencies as:

    compile 'com.android.support:appcompat-v7:27.0.0'

and stay connected to internet and download whatever repository it asks.

Hope it helps.

0

replace maven {url "https://maven.google.com"} with google(); the location has changed.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • My gradle version is 2.14.1 so thats not the case. If I use google() i get an error that says that the method google() could not be found. That's for later versions – Simon Iyamu Aug 08 '18 at 20:37
0

Installing the newest Android Studio version solved the problem

Simon Iyamu
  • 81
  • 1
  • 6