android studio failed to resolve: runner and failed to resolve: espresso-core and failed to resolve: monitor

北城以北 提交于 2019-12-11 18:44:12

问题


I installed android studio 3.1.3 and when I tried to build a new application .. During the gradle synchronization I had a problem as in the following picture:

Failed to resolve: espresso-core Open File

Failed to resolve: runner Open File

Failed to resolve: monitor Open File

and that is my app(build.gradle):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.tareq.ds"
        minSdkVersion 28
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

and that is my project(build.gradle):

buildscript {

    repositories {
        google()
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()

    }
}

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

回答1:


Follow these steps:

  • Open Module setting for the application
  • Under dependencies, tab Click on '+' Symbol and add all the required dependencies one by one
  • Click on Apply button


来源:https://stackoverflow.com/questions/50899118/android-studio-failed-to-resolve-runner-and-failed-to-resolve-espresso-core-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!