Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve: com.android.support:appcompat-v7 24.0.1

I have searched around a lot but I cannot really find a post that helps I am somewhat new to android so some of this goes over my head. Anyway, my problems started when I got an error saying gradle plugin was old and the sync would not complete. So I changed a few things around not really sure what I did. Now I have:

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

Project gradle file:

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

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

app gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"
    defaultConfig {
        applicationId "com.bisesifreelance.maxbisesi.tic_tac_toe"
        minSdkVersion 23
        targetSdkVersion 24
        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:24.0.1'
    testCompile 'junit:junit:4.12'
}

Also I have installed all build tools in SDK manager I'm not allowed to embed images yet? but it says:

Android SDK Plaform-Tools 24.03 installed

Android SDK Tools 25.2.2 installed

Thank YOu! I'm very lost.

like image 222
SallyRothroat Avatar asked Sep 15 '16 20:09

SallyRothroat


3 Answers

You can also write like this:

allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
like image 185
VolodymyrH Avatar answered Oct 25 '22 17:10

VolodymyrH


try

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

EDIT

For sdk 27

buildToolsVersion "27.0.3"

implementation "com.android.support:appcompat-v7:27.1.1"
like image 36
Tiago Oliveira Avatar answered Oct 25 '22 18:10

Tiago Oliveira


Try adding jcenter like this way

repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
}

Rather than

  repositories {
        jcenter()
    }
like image 8
Mithun Sarker Shuvro Avatar answered Oct 25 '22 17:10

Mithun Sarker Shuvro