【问题标题】:android studio failed to resolve: runner and failed to resolve: espresso-core and failed to resolve: monitorandroid studio 无法解析:runner 无法解析:espresso-core 无法解析:monitor
【发布时间】:2018-06-17 17:50:57
【问题描述】:

我安装了 android studio 3.1.3,当我尝试构建一个新应用程序时.. 在 gradle 同步期间,我遇到了如下图所示的问题:

无法解决:espresso-core 打开文件

未能解决:跑步者 打开文件

无法解决:监视器 打开文件

这就是我的应用程序(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'
}

这就是我的项目(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
}

【问题讨论】:

  • 可能是stackoverflow.com/questions/50786296/… 的重复项,可以尝试添加“jcenter()”吗?要尝试的另一件事是进行构建(而不是 Gradle 同步)。我发现构建错误更有帮助。
  • @TylerV 我尝试使用 Jcenter() 但同样的问题我也尝试将 Jcenter 和 maven 放在一起每次我清理项目和重建项目时,但这并不能解决我的问题: (
  • 那么不确定。也许尝试构建会给你一个更有用的错误信息。
  • 我正在尝试安装额外的 sdk,但我认为这对我没有帮助......因为这个问题我有点困惑

标签: android android-studio gradle build.gradle


【解决方案1】:

按照以下步骤操作:

  • 打开应用程序的模块设置
  • 在依赖项下,选项卡单击“+”符号并添加所有必需的 一一依赖
  • 点击应用按钮

【讨论】:

  • 太好了,很高兴为您提供帮助。
猜你喜欢
  • 2023-04-06
  • 1970-01-01
  • 1970-01-01
  • 2018-01-28
  • 2015-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多