gpt4 book ai didi

android - 如何解决此错误:无法解决:com.android.support:appcompat-v7:26.1.0

转载 作者:行者123 更新时间:2023-12-03 04:59:59 27 4
gpt4 key购买 nike

我刚刚安装了Android Studio 3.0.1,从上次询问此问题开始,我尝试了许多解决方案,但似乎都没有用。我仍然收到此错误:无法解决:com.android.support:appcompat-v7:26.1.0

我的顶级构建文件如下:

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

allprojects{
repositories{
jcenter()
}
}
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android plugin 3.0.0 or higher.
maven { url "https://maven.google.com" }
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

我的应用程序build.gradle文件包括:
apply plugin: 'com.android.application'

repositories {
maven { url "https://maven.google.com" }
jcenter { url "http://jcenter.bintray.com/" }
}

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
applicationId "com.example.application"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {

release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:23.1.1'
}

最佳答案

您的项目build.gradle应该与此相似

buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

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

而且您应该为您的库使用相同的版本,如下所示:
implementation "com.android.support:appcompat-v7:26.0.1"
implementation "com.android.support:design:26.0.1"

关于android - 如何解决此错误:无法解决:com.android.support:appcompat-v7:26.1.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47728494/

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