【问题标题】:ERROR: Failed to resolve: espresso-core and ERROR: Failed to resolve: runner错误:无法解决:浓缩咖啡核心和错误:无法解决:跑步者
【发布时间】:2019-12-04 16:27:35
【问题描述】:

我要建立一个项目。创建项目时遇到如下错误

ERROR: Failed to resolve: espresso-core
Affected Modules: mvp-app


ERROR: Failed to resolve: runner
Affected Modules: mvp-app

还有我的 build.gradle(module) 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "ir.sabmanage.mvp"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    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'

    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
}

还有我的 build.gradle(project) 文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()

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

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

allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://maven.google.com' }
        google()
        jcenter()
        maven { url 'https://jitpack.io' }

    }
}

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

如何解决这个错误?有没有人遇到过这个问题? 我找到了解决方案,但它没有回答我 android studio failed to resolve: runner and failed to resolve: espresso-core and failed to resolve: monitor

【问题讨论】:

    标签: android android-gradle-plugin


    【解决方案1】:

    如果您使用的是 androidx 依赖项,您可能需要替换以下实现:

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    

    这些:

    androidTestImplementation 'androidx.test:runner:1.3.0-alpha03'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03'
    

    【讨论】:

      【解决方案2】:

      espresso 3.1.0 是最新的可用版本。你也不需要mavencentral repo。有关 build.gradle 的详细信息,请参阅示例代码。

      https://developer.android.com/training/testing/espresso/setup

      【讨论】:

      • hi androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.2.0' 此项目不存在并得到错误ERROR: Failed to resolve: com.android.support.test.espresso:espresso-core:3.2.0'
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-15
      • 1970-01-01
      • 2018-01-05
      • 1970-01-01
      • 1970-01-01
      • 2018-06-05
      • 2015-04-08
      相关资源
      最近更新 更多