无法解析:com.android.support:appcompat-v7.27.+ [重复]

2024-01-07

我正在尝试使用 Nougat 7.0 在 Android Studio 中创建一个新项目。

但是,一旦我打开项目,我就会收到以下 Gradle 错误:

无法解决:com.android.support:appcompat-v7.27.+

我尝试过一些在线解决方案,但没有一个对我有用。

以下是模块(应用程序)build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "damo.com.testproject"
    minSdkVersion 23
    targetSdkVersion 27
    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:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

我需要进行哪些更改才能解决此问题?


未找到 Gradle DSL 方法:“google()”

Set

compileSdkVersion 27
buildToolsVersion "27.0.3"

确保已添加google()在你的PROJECT LEVEL build.gradle部分。

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com/' }

    }
}

如果你设置一下会更好PROPER版本。

compile 'com.android.support:appcompat-v7:27.1.1' 

FYI

Use implementation代替compile. i.e

implementation 'com.android.support:appcompat-v7:27.1.1' 

在那之后,Clean-Rebuild-Run.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法解析:com.android.support:appcompat-v7.27.+ [重复] 的相关文章

随机推荐