【问题标题】:Error:resource style/TextAppearance.Compat.Notification.Info (aka {packageId}.test:style/TextAppearance.Compat.Notification.Info) not found错误:找不到资源样式/TextAppearance.Compat.Notification.Info(又名 {packageId}.test:style/TextAppearance.Compat.Notification.Info)
【发布时间】:2020-07-01 15:20:32
【问题描述】:

我刚刚将 build.gradle 编译 SDK 更新为 27 API。

compileSdkVersion 27
buildToolsVersion '27.0.3'
targetSdkVersion 27

但是一旦我点击同步按钮,它就会抛出

error: resource style/TextAppearance.Compat.Notification.Info (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification.Info (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification.Info (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification (aka  {packageId}.test:style/TextAppearance.Compat.Notification) not found.
error: resource style/TextAppearance.Compat.Notification (aka  {packageId}.test:style/TextAppearance.Compat.Notification) not found.
error: resource style/TextAppearance.Compat.Notification (aka  {packageId}.test:style/TextAppearance.Compat.Notification) not found.
error: resource style/TextAppearance.Compat.Notification.Time (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Time) not found.
error: resource style/TextAppearance.Compat.Notification.Time (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Time) not found.
error: resource style/TextAppearance.Compat.Notification.Time (aka {packageId}.test:style/TextAppearance.Compat.Notification.Time) not found.
error: resource style/TextAppearance.Compat.Notification.Title (aka {packageId}.test:style/TextAppearance.Compat.Notification.Title) not found.
error: resource style/TextAppearance.Compat.Notification.Title (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Title) not found.
error: resource style/TextAppearance.Compat.Notification.Title (aka  {packageId}.test:style/TextAppearance.Compat.Notification.Title) not found.
error: failed linking references.

但是使用 SDK 26 构建过程没问题

【问题讨论】:

    标签: android gradle synchronization


    【解决方案1】:

    以前:

    android:textAppearance="@style/TextAppearance.AppCompat.Notification"
    

    现在以下是正确的:

    android:textAppearance="@style/TextAppearance.Compat.Notification"
    

    自:

    compileSdkVersion 27
    buildToolsVersion "27.0.3" 
    minSdkVersion 19 
    targetSdkVersion 27
    

    【讨论】:

    • 在哪里添加这一行 android:textAppearance="@style/TextAppearance.Compat.Notification" ??
    • 请详细说明@jhandei
    • @Quicklearner 看看my answer on this post,也许对你有帮助
    • 在每个文本视图中?
    • 在哪里进行此更改?
    【解决方案2】:

    就我而言,我通过从 Gradle 上删除所有缓存的库来解决它:

    \{userFolder}\.gradle\caches
    

    【讨论】:

    • 在我的情况下,构建失败似乎发生在没有真正更改代码或迁移到新 SDK 之后,我在项目中移动了很多。我还收到了几条奇怪的锁定文件消息。不管怎样,清除这个缓存解决了这个问题。
    【解决方案3】:

    如果你仍然想使用支持库而不是 AndroidX,我已经在 gradle 中添加了这一行

    implementation 'com.android.support:support-v4:28.0.0'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-21
      • 1970-01-01
      • 2019-02-21
      • 2020-08-27
      • 1970-01-01
      • 1970-01-01
      • 2020-08-02
      相关资源
      最近更新 更多