gpt4 book ai didi

android-studio - 无法解析 com.android.support.espresso :espresso-core:2. 2.2

转载 作者:行者123 更新时间:2023-12-03 17:46:16 25 4
gpt4 key购买 nike

我刚刚第一次下载 android studio,我遇到了 gradle 错误。我已经下载了 SDK 提供的所有内容,但仍然出现相同的错误。

apply plugin: 'com.android.application'

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

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.+'
testCompile 'junit:junit:4.12'
}

我得到的错误是

  (Failed to resolve: com.android.support.appcompat-v7:25.+)

(Failed to resolve: com.android.support.espresso:espresso-core:2.2.2)

顺便说一句,一切都是最新的,请帮忙,刚开始时这真的很令人沮丧。

**根据答案一编辑-已安装工具的图片--- sdktoolsscreenshot

代码表单项目build.gradle

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

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

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

allprojects {
repositories {
jcenter()
}
}

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

新错误消息_____ newerrorscreenshot

最佳答案

failed to resolve com.android.support.espresso:espresso-core:2.2.2

重构布局名称时可能会出现此错误。

我遇到了同样的问题,我的错误是我创建了命名为 test.xml 的布局,然后当我用 layout_offers.xml 重构该名称时,我的gradle 被更改为类似


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.detail_layout.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
})

鉴于它应该像 follow

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

因此,一种解决方案是我们应该避免使用 test.xml 作为布局名称。

关于android-studio - 无法解析 com.android.support.espresso :espresso-core:2. 2.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41918891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com