无法在Gradle中编译新的材质库 [英] Can't compile new Material library in Gradle

查看:79
本文介绍了无法在Gradle中编译新的材质库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法添加新的材料设计库. 添加compile 'com.google.android.material:material:1.0.0-alpha1'并同步项目时,出现两个错误:

I can't add the new Material Design library. When I add compile 'com.google.android.material:material:1.0.0-alpha1' and I sync the project, I get this two errors:

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'
}

有什么建议吗?

谢谢!

推荐答案

要使用新的材料组件库 'com.google.android.material:material:1.0.0-alpha1'您必须使用

To use the new Material Components library 'com.google.android.material:material:1.0.0-alpha1' you have to use

android {
        compileSdkVersion 'android-P'

        defaultConfig {
            targetSdkVersion 'P'
        }
        ...
    }

这篇关于无法在Gradle中编译新的材质库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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