Gradle:浓缩咖啡核心和appcompat未能解决;SDK 安装没有附加功能



我已经安装了Android Studio,并尝试创建应用程序。

我的build.gradle模块文件是:

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.a79231.myapplication"
minSdkVersion 22
targetSdkVersion 26
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.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
testCompile 'junit:junit:4.12'
}

我已经安装了 sdk 工具并安装了 26.0.0

我有错误:

  1. 错误:(23, 24( 无法解决: com.android.support.test.espresso:espresso-core:2.0 安装存储库和同步项目
    在文件中
    显示

  2. 错误:(26, 13( 无法解决: com.android.support:appcompat-v7:26.+ 安装存储库和同步项目
    在文件中
    显示

  3. SDK 安装没有附加功能

  4. 事件日志显示:需要 Android SDK 工具版本 24.0.2 或更高版本。安装最新的 SDK 工具。为什么?我有26个。

我尝试将 espresso-core:2.0 更改为 espresso-core:2.2,将 appcompat-v7:26.+ 更改为 appcompat-v7:26.0.0,但错误是相同的。 我也尝试重新安装Android Studio。结果是一样的。

添加到主 build.gradle in repository 块

Maven { URL 'https://maven.google.com' }

最新更新