无法解决:com.android.support:appcompat-v7.27.+ [英] Failed to resolve: com.android.support:appcompat-v7.27.+

查看:76
本文介绍了无法解决:com.android.support:appcompat-v7.27.+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to create a new project in Android Studio, using Nougat 7.0.

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

But, as soon as I open the project I get the following Gradle error:

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

Failed to resolve: com.android.support:appcompat-v7.27.+

我尝试了一些在线解决方案,但是没有一个对我有用.

I have tried some online solutions, but none of them have been working for me.

下面是Module(应用)build.gradle:

Below is the Module (app) 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'
}

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

What changes do I need to make to resolve this issue?

推荐答案

找不到Gradle DSL方法:"google()"

Gradle DSL method not found: 'google()'

设置

compileSdkVersion 27
buildToolsVersion "27.0.3"

确保在您的 PROJECT LEVEL build.gradle 中添加了 google() >部分.

Make sure added google() in Your PROJECT LEVEL build.gradle section.

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

    }
}

如果设置 PROPER 版本会更好.

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

仅供参考

使用 实现 ,而不是 编译 .即

Use implementation instead of compile. i.e

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

此后, Clean-Rebuild-Run .

After that, Clean-Rebuild-Run.

这篇关于无法解决:com.android.support:appcompat-v7.27.+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆