我在 Android Studio 中遇到了这个问题。
Error:(22, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="openFile:C:/Users/username/AndroidStudioProjects/ElectroSave/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
这是我的 Gradle 代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.noelly.myapplication"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0'
}
原文由 CyberCat 发布,翻译遵循 CC BY-SA 4.0 许可协议
要使用从版本 26.0.0 开始的支持库,您需要将 Google 的 Maven 存储库添加到项目的 build.gradle 文件中,如下所述: https ://developer.android.com/topic/libraries/support-library/setup.html
对于 Android Studio 3.0.0 及更高版本: