android studio 3.0版本在bulild.gradle

时间:2017-11-13 11:37:51

标签: android android-recyclerview android-gradle android-studio-3.0

错误图片 enter image description here

我最近将我的android studio更新为3.0,而我在build.gradle(module.app)中添加了对recycleler视图的依赖,而卡片视图工作正常。它显示了显示的错误.Below是我的依赖代码。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.m.listviewslow"
        minSdkVersion 15
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

2 个答案:

答案 0 :(得分:0)

添加 maven {url' https://maven.google.com'您的项目级build.gradle。

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

https://developer.android.com/topic/libraries/support-library/setup.html

答案 1 :(得分:0)

像这样编辑你的build.gradle文件

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