找不到属性 app:useSimpleSummaryProvider

Can not find attribute app:useSimpleSummaryProvider

我想更新我的偏好摘要,我发现了一个叫做 SimpleSummaryProvider 的东西 here。但在我的例子中,它说找不到属性 app:useSimpleSummaryProvider,在 Java 代码中,它说无法解析 SummaryProvider class。我的应用程序级别构建 Gradle 依赖项为-

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'

不知道是不是漏了什么。 我将不胜感激任何帮助

app:useSimpleSummaryProvider是根据AndroidX release notesandroidx.preference 1.1.0-alpha01中新增的(在页面中搜索app:useSimpleSummaryProvider)。

因此您需要迁移到AndroidX并更新到最新的androidx alpha版本。

将实施更改为 'androidx.preference:preference:1.1.0' 执行 'androidx.preference:preference:1.2.0' 就可以了。 https://developer.android.com/jetpack/androidx/releases/preference#1.2.0