我尝试使用Android Material组件库:https://github.com/material-components/material-components-android
用于获取重要的日期选择器。在将其添加到gradle:implementation 'com.google.android.material:material:1.1.0-alpha09'
并构建项目后,出现错误消息:
Android resource linking failed
warn: removing resource
.../values.xml:3332: error: style attribute 'android:attr/dialogCornerRadius' not found.
.../values-v28.xml:15: error: resource android:attr/dialogCornerRadius not found.
.../values-v28.xml:19: error: resource android:attr/dialogCornerRadius not found.
.../values.xml:6855: error: resource android:attr/fontVariationSettings not found.
.../values.xml:6855: error: resource android:attr/ttcIndex not found.
.../values.xml:7134: error: resource android:attr/lineHeight not found.
.../values.xml:7139: error: resource android:attr/lineHeight not found.
.../values.xml:7354: error: resource android:attr/textFontWeight not found.
error: failed linking references.
据我所知,存在AndroidX和支持库冲突。
库文档指出必须迁移到AndroidX。
如何在不进行迁移的情况下使用该库,或者也许有人知道类似的物料日期选择器库?
最佳答案
您可以找到另一个物料日期选择器库here。为了解决链接错误,您可以尝试以下步骤:
1)在gradle.properties文件中添加以下代码:
android.useAndroidX=true
android.enableJetifier=true
2)在应用程序级别build.gradle中,在
buildTypes
中添加以下代码:compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
3)将
compileSdkVersion
和buildToolsVersion
设置为28。