简体   繁体   English

无法解决:com.android.support.test.espresso:espresso-core:3.0.1使用Android Studio 3.0.1

[英]Failed to resolve: com.android.support.test.espresso:espresso-core:3.0.1 Using Android Studio 3.0.1

My gradle project will not sync and throws the following errors: 我的gradle项目将无法同步,并引发以下错误:

Failed to resolve:com.android.support.test.espresso:espresso-core:3.0.1
Failed to resolve:com.android.support.test:runner:1.0.1

This is not a duplicate of previous questions because I have already included maven which was the solution to this question: Android Studio can't resolve Espresso 3.0.0 这不是以前的问题的重复,因为我已经包含了maven,它是此问题的解决方案: Android Studio无法解决Espresso 3.0.0

Here is my gradle: 这是我的礼物:

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

    dependencies {
        //classpath 'com.android.tools.build:gradle:1.1.0'
        classpath 'com.android.tools.build:gradle:3.0.1'

    }
}

apply plugin: 'com.android.application'


dependencies {

    compile "com.android.support:support-v4:24.2.1"
    compile "com.android.support:support-v13:24.2.1"
    compile "com.android.support:cardview-v7:24.2.1"
    androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
    androidTestCompile 'com.android.support.test:runner:1.0.1'
}

// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
    'main',     // main sample code; look here for the interesting stuff.
    'common',   // components that are reused by multiple samples
    'template'] // boilerplate code that is generated by the sample template process

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        minSdkVersion 25
        targetSdkVersion 26
        applicationId "com.example.android.mediabrowserservice"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    sourceSets {
        main {
            dirs.each { dir ->
                java.srcDirs "src/${dir}/java"
                res.srcDirs "src/${dir}/res"
//                assets.srcDirs "src/${dir}/assets" //added to show asset folder
            }
        }
        androidTest.setRoot('tests')
        androidTest.java.srcDirs = ['tests/src']

    }


    lintOptions {
        abortOnError false
    }
}

With including the maven in the repositories, I'm not sure why else this would not be working. 通过将Maven包括在存储库中,我不确定为什么其他方法无法正常工作。 What can I do so that android recognizes the espresso dependencies? 我该怎么做才能让android识别espresso依赖项? Thanks! 谢谢!

Edit: Here is the project gradle: 编辑:这是项目gradle:

repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
        jcenter()
    }
}
buildscript {
    repositories {
        maven {
            url 'https://maven.google.com/'
            name 'Google'
            jcenter()

        }
    }
}

I'm not sure that I am suppose to add the google() and jcenter() in both blocks but the same error exist with or without them in each block 我不确定我是否想在两个块中都添加google()和jcenter(),但是在每个块中存在或不存在它们时都存在相同的错误

Update: I tried downloading hamcrest and junit jar files and pointed to those two files for dependencies and that seemed to help with a few issues but I can't find espresso jar files! 更新:我尝试下载hamcrest和junit jar文件,并指出了这两个文件的依赖性,这似乎可以解决一些问题,但是我找不到espresso jar文件! Still at a loss here unfortunately 不幸的是这里仍然茫然

This is probably because you're forgetting adding the google() maven in another dependencies block in root / project build.gradle: 这可能是因为您忘记了在 / 项目 build.gradle的另一个依赖项块中添加google()maven:

buildscript {

    repositories {
        // this is for the classpath repository
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    // This is for your all module dependencies
    // you probably forget this block.
    repositories {
        google()
        jcenter()
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解决:com.android.support.test.espresso:espresso-core:2.3.3 - Failed to resolve: com.android.support.test.espresso:espresso-core:2.3.3 无法解析com.android.support.test:runner:1.0.0和&#39;com.android.support.test.espresso:espresso-core:3.0.0&#39; - Failed to resolve com.android.support.test:runner:1.0.0 and 'com.android.support.test.espresso:espresso-core:3.0.0' 无法解析com.android.support.test.espresso:espressgit so-core:3.0.1 - Could not resolve com.android.support.test.espresso:espressgit so-core:3.0.1 无法解决:com.android.support.test.espresso - Failed to resolve: com.android.support.test.espresso Android Studio 无法解决:.espresso:espresso-core:3.2.0 - Android Studio Failed to resolve: .espresso:espresso-core:3.2.0 无法解决:com.android.support.test.espresso:espresso-intents:27.0.2 - Failed to resolve: com.android.support.test.espresso:espresso-intents:27.0.2 android studio无法解决:亚军,但无法解决:espresso-core,但无法解决:监控 - android studio failed to resolve: runner and failed to resolve: espresso-core and failed to resolve: monitor Android Studio Gradle项目同步 - 无法解析Espresso-Core和Appcompat - Android Studio Gradle Project Sync - Failed To Resolve Espresso-Core and Appcompat 错误:无法解析:espresso-core 和错误:无法解析:runner - ERROR: Failed to resolve: espresso-core and ERROR: Failed to resolve: runner Firebase无法正常运行Android Studio 3.0.1 [com.android.support:support-core-utils:27.1.0] - Firebase not working Android Studio 3.0.1 [com.android.support:support-core-utils:27.1.0]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM