23

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.

Community
  • 1
  • 1
MadMax
  • 605
  • 1
  • 6
  • 19

9 Answers9

25

You can also write like this:

allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
VolodymyrH
  • 1,927
  • 2
  • 18
  • 47
15

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"
Tiago Oliveira
  • 1,582
  • 1
  • 16
  • 31
  • 4
    I'm getting `Error:Could not find com.android.support:appcompat-v7:25.0.1`. Any idea why? – b.lyte Dec 02 '16 at 02:20
8

Try adding jcenter like this way

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

Rather than

  repositories {
        jcenter()
    }
Mithun Sarker Shuvro
  • 3,902
  • 6
  • 32
  • 64
7

Make sure that this folder exists:

\your-android-sdk\extras\android\m2repository\com\android\support\appcompat-v7\24.0.1

Of course, 24.0.1 should be replaced by the latest version.

I had this problem because I occasionally renamed 24.0.1 to something else and so the required folder couldn't be found.

activity
  • 431
  • 1
  • 7
  • 9
3

I had the same problem after updating Android Studio. In my case it was an issue of permissions as I do my day-to-day programming on my user account, while Android studio was installed and updated with the administrator account.

FIX:

Open the standalone SDK manager and go down to 'extras'. Click on 'Android Support Repository' (which will probably set as 'Not installed') and install the packages. If you are prompted with an error message saying something like 'error trying to rename folder'. Go to the folder that is mentioned in the message and make sure that the permissions are set correctly. After that click 'Try Again' and it should install the package without a problem.

NOTE: This might happen a few more times. Just repeat the process for each file. The problem should then be solved.

Kesupile K
  • 151
  • 1
  • 7
1

Change a character - to :

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

rather than

compile 'com.android.support:appcompat-v7-24.2.1'
MinnuKaAnae
  • 1,646
  • 3
  • 23
  • 35
0

try update the IDE and remove earlier build version (like 23) after installing later one and rename it to newer one.

0

Open SDK Manager and update the Extras-->Android Support Repository.

Path ..sdk\extras\android\m2repository\com\android\support\appcompat-v7>

Check for the updated version being installed.

Chinmoy
  • 1,391
  • 13
  • 14
0

In build.gradle in all projects, add Marvel and add this URL 'https://maven.google.com'

renish p.r
  • 105
  • 1
  • 5