6

This is my build.gradle(app)

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
    
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
    }
}

ant.importBuild 'assets.xml'
preBuild.dependsOn(list, checksum)
clean.dependsOn(clean_assets)

def dagger_version = "2.10"
def retrofit2_version = "2.2.0"
def support_package_version = "26.0.0-alpha1"
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //dagger
    compile "com.google.dagger:dagger:${dagger_version}"
    annotationProcessor "com.google.dagger:dagger-compiler:${dagger_version}"
    //retrofit2
    compile "com.squareup.retrofit2:retrofit:${retrofit2_version}"
    compile "com.squareup.retrofit2:converter-jackson:${retrofit2_version}"
    //okhttp3
    //support packages
    compile "com.android.support:appcompat-v7:${support_package_version}"
    compile "com.android.support:cardview-v7:${support_package_version}"
    compile "com.android.support:design:${support_package_version}"

    compile project(':pocketsphinx-android-5prealpha-release')
    compile 'pl.bclogic:pulsator4droid:1.0.3'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'

    compile 'com.android.support:support-annotations:25.3.1'


    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.0'
    androidTestCompile 'com.android.support.test:runner:1.0.0'

    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
}

I have noted the controversial dependencies from here And I get the following errors

Failed to resolve:com.android.support.test.espresso:espresso-core:3.0.0

Failed to resolve:com.android.support.test:runner:1.0.0

I have updated the sdk manager, but still facing this. Do I have to downgrade to a lower version? Can anyone help?

Community
  • 1
  • 1
Debanjan
  • 2,817
  • 2
  • 24
  • 43

1 Answers1

8

I had the same problem when I wanted to try Espresso.

I've resolved it by adding

        maven {
            url "https://maven.google.com"
        }

to

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

in the project's build.gradle file. See https://developer.android.com/topic/libraries/testing-support-library/packages.html#gradle-dependencies.

mimo31
  • 335
  • 3
  • 12
  • 1
    I still had it, I added the dependency to my app level build.gradle, only then was it resolved. – Debanjan Aug 16 '17 at 15:19
  • What did you add to build.gradle ? – Vasanth Aug 12 '20 at 12:10
  • @Vasanth It's quite some time ago at this point, but I would say I added ```maven { url "https://maven.google.com" }``` so that the corresponding part of the ```build.gradle``` file looked like the second code block in my answer. – mimo31 Aug 12 '20 at 12:16
  • @Vasanth note however that the link in my answer now suggests adding ```google()``` instead of ```maven { ... }``` – mimo31 Aug 12 '20 at 12:18
  • Thanks for the answer, in my case, I was missing some jars, after adding them it started working. – Vasanth Aug 13 '20 at 04:49