0

Got this 4 errors:

Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:24.0.0
Error:(27, 13) Failed to resolve: com.android.support:design:24.0.0
Error:Failed to resolve: com.android.support:support-v4:24.0.0

The code:

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    defaultConfig {
        applicationId "com.adir.remember"
        minSdkVersion 15
        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.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.google.firebase:firebase-appindexing:10.0.0'
}

How can I fix errors above?

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
Michael
  • 189
  • 1
  • 10

2 Answers2

0

You should read the document about configure build for more about refer here

Then, in your gradle add the following lib's

androidTestCompile 'com.android.support:support-annotations:23.1.0'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
compile 'com.google.android.gms:play-services:7+'
compile 'com.android.support:appcompat-v7:23.4.0'

Hope it will help.!

Community
  • 1
  • 1
Raju
  • 1,183
  • 3
  • 11
  • 19
0

Please be sure about your library, because your compileSdkVersion and buildToolsVersion both are different so please set same, its not required but its better for us. Your compile 'com.android.support:appcompat-v7:23.4.0' library version is also different. Please set compileSdkVersion 24 and buildToolsVersion 24.0.0 same. I suggest that use compileSdkVersion and buildToolsVersion and your every library version will be same .
In my case i used as below and it's working fine for me

    android {
        compileSdkVersion 24
        buildToolsVersion "24.0.0"

    }

    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:23.0.1'
    }
    ...

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude module: 'support-annotations'
        exclude module: 'support-v4'
        exclude module: 'support-v13'
        exclude module: 'recyclerview-v7'
        exclude module: 'design'
        module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.google.firebase:firebase-appindexing:10.0.0'
}
Farmer
  • 4,093
  • 3
  • 23
  • 47
  • I edited the code as you said , everything is 24 still it's giving me errors like: Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:24.0.0 Error:(25, 13) Failed to resolve: com.android.support:design:24.0.0 Error:(26, 13) Failed to resolve: com.google.firebase:firebase-appindexing:10.0.0 – Michael Nov 26 '16 at 13:03
  • Have you update that library in your SDK ? if you not then please update it. please share your error message screen short – Farmer Nov 26 '16 at 13:50
  • please see my updated answer else please see this http://stackoverflow.com/questions/37307671/android-espresso-cotrib-gradle-build-failing/37484833#37484833 – Farmer Nov 26 '16 at 15:12
  • it's giving me a new error : "Error:(30, 0) Cannot set the value of read-only property 'module' for project ':app' of type org.gradle.api.Project." – Michael Nov 26 '16 at 15:59
  • Edited the post.. got some new errors after trying to change things.. would be awesome if you can help me – Michael Nov 29 '16 at 17:22
  • I suggest you that you just Update your SDK and reinstall your android studio 2.2 and create one simple project and check is it ok or not ? – Farmer Nov 30 '16 at 05:40