2

I am trying to create a new project in Android Studio, using Nougat 7.0.

But, as soon as I open the project I get the following Gradle error:

Failed to resolve: com.android.support:appcompat-v7.27.+

I have tried some online solutions, but none of them have been working for me.

Below is the Module (app) build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "damo.com.testproject"
    minSdkVersion 23
    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'
    }
}
}

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

compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

What changes do I need to make to resolve this issue?

3 Answers3

0

replace with this

com.android.support:support-compat:27.1.1

nishant
  • 2,526
  • 1
  • 13
  • 19
0

Gradle DSL method not found: 'google()'

Set

compileSdkVersion 27
buildToolsVersion "27.0.3"

Make sure added google() in Your PROJECT LEVEL build.gradle section.

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

    }
}

It will be better if you set PROPER version.

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

FYI

Use implementation instead of compile. i.e

implementation 'com.android.support:appcompat-v7:27.1.1' 

After that, Clean-Rebuild-Run.

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
0

buildToolsVersion "25.0.2" change this to "27.0.0" and everything is going to be correct

Hamza
  • 251
  • 3
  • 14