【问题标题】:Can't compile new Material library in Gradle无法在 Gradle 中编译新的材料库
【发布时间】:2018-05-15 07:17:16
【问题描述】:

我无法添加新的 Material Design 库。 当我添加compile 'com.google.android.material:material:1.0.0-alpha1' 并同步项目时,我得到了这两个错误:

error: resource android:attr/fontVariationSettings not found.
error: resource android:attr/ttcindex not found.

我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "rockthesport.com.pruebasmaterial"
        minSdkVersion 19
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    compile 'com.google.android.material:material:1.0.0-alpha1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

有什么建议吗?

谢谢!

【问题讨论】:

标签: android android-gradle-plugin material-design


【解决方案1】:

要使用新的Material Components library 'com.google.android.material:material:1.0.0-alpha1',您必须使用

android {
        compileSdkVersion 'android-P'

        defaultConfig {
            targetSdkVersion 'P'
        }
        ...
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-11
    • 1970-01-01
    • 2018-03-08
    • 2015-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-05
    相关资源
    最近更新 更多