Выход: ошибка: стиль ресурса /TextAppearance.Compat.Notification.Info (иначе имя_пакета: style/TextAppearance.Compat.Notification.Info) не найден

После перехода на Android Studio 3.2 канарейка я получаю следующую ошибку сборки.

Я видел этот пост, где у парня была похожая проблема, но не было упомянуто их решение.

Я хочу попробовать новые компоненты материала и реактивный ранец, так что есть ли вероятность, что мне не придется переключаться обратно.

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
Output:  error: resource style/TextAppearance.Compat.Notification.Info (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification.Info (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification.Info (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification) not found.
error: resource style/TextAppearance.Compat.Notification (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification) not found.
error: resource style/TextAppearance.Compat.Notification (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification) not found.
error: resource style/TextAppearance.Compat.Notification.Time (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Time) not found.
error: resource style/TextAppearance.Compat.Notification.Time (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Time) not found.
error: resource style/TextAppearance.Compat.Notification.Time (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Time) not found.
error: resource style/TextAppearance.Compat.Notification.Title (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Title) not found.
error: resource style/TextAppearance.Compat.Notification.Title (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Title) not found.
error: resource style/TextAppearance.Compat.Notification.Title (aka com.nsnik.nrs.kotlintest.debug:style/TextAppearance.Compat.Notification.Title) not found.
error: failed linking references.

build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 'android-P'
defaultConfig {
    applicationId "com.nsnik.nrs.kotlintest"
    minSdkVersion 24
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    javaCompileOptions {
        annotationProcessorOptions {
            arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
        }
    }
}
sourceSets {
    androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
buildTypes {
    debug {
        applicationIdSuffix '.debug'
        versionNameSuffix '-DEBUG'
        ext.alwaysUpdateBuildId = false
    }
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
allprojects {
    tasks.withType(JavaCompile) {
        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Xlint:cast" << "-Xlint:empty" << "-Xmaxerrs"
    }
}
testOptions {
    execution 'ANDROID_TEST_ORCHESTRATOR'
}
androidExtensions {
    experimental = true
}
kapt {
    correctErrorTypes = true
}
configurations.all {
    exclude group: "androidx.core"
    exclude module: "graphics"
}
buildToolsVersion '28.0.0 rc2'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

//KOTLIN
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

//ANDROID-KTX
implementation "androidx.core:core-ktx:$rootProject.androidKTXVersion"

//MATERIAL-COMPONENTS
implementation "com.google.android.material:material:$rootProject.materialComponentVersion"

//APPCOMPAT LIBRARY
implementation "com.android.support:appcompat-v7:$rootProject.supportLibVersion"

//RECYCLER VIEW
implementation "com.android.support:recyclerview-v7:$rootProject.supportLibVersion"

//ANNOTATION SUPPORT LIBRARY
implementation "com.android.support:support-annotations:$rootProject.supportLibVersion"

//DESIGN SUPPORT LIBRARY
implementation "com.android.support:design:$rootProject.supportLibVersion"

//CONSTRAINT LAYOUT
implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion"

//FINDBUGS JSR305
implementation "com.google.code.findbugs:jsr305:$rootProject.findBugJsr305Version"

//RX-ANDROID
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"

//RX-JAVA
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxJavaVersion"

//RX BINDING
implementation "com.jakewharton.rxbinding2:rxbinding:$rootProject.rxBindingVersion"
implementation "com.jakewharton.rxbinding2:rxbinding-support-v4:$rootProject.rxBindingVersion"
implementation "com.jakewharton.rxbinding2:rxbinding-appcompat-v7:$rootProject.rxBindingVersion"
implementation "com.jakewharton.rxbinding2:rxbinding-design:$rootProject.rxBindingVersion"
implementation "com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:$rootProject.rxBindingVersion"

//TIMBER LOGGER
implementation "com.jakewharton.timber:timber:$rootProject.timberVersion"

//DAGGER 2
implementation "com.google.dagger:dagger-android:$rootProject.daggerVersion"
implementation "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"
implementation 'com.android.support:support-v4:28.0.0-alpha1'
kapt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"

//EVENT BUS
implementation "org.greenrobot:eventbus:$rootProject.eventBusVersion"

//AUTO VALUE
compileOnly "com.google.auto.value:auto-value:$rootProject.autoValueVersion"
annotationProcessor "com.google.auto.value:auto-value:$rootProject.autoValueVersion"

//AUTO PARCEL
annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:$rootProject.autoParcelVersion"

//AUTO VALUE GSON
annotationProcessor "com.ryanharter.auto.value:auto-value-gson:$rootProject.autoValueGsonExtension"
provided "com.ryanharter.auto.value:auto-value-gson:$rootProject.autoValueGsonExtension"

//LEAK CANARY
debugImplementation "com.squareup.leakcanary:leakcanary-android:$rootProject.leakCanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$rootProject.leakCanaryVersion"

//BLOCK CANARY
implementation "com.github.markzhai:blockcanary-android:$rootProject.blockCanaryVersion"

// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.architectureComponentVersion"
// Lifecycles only (no ViewModel or LiveData). Some UI
implementation "androidx.lifecycle:lifecycle-runtime:$rootProject.architectureComponentVersion"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$rootProject.architectureComponentVersion"
// optional - ReactiveStreams support for LiveData
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$rootProject.architectureComponentVersion"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$rootProject.architectureComponentVersion"

//room
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$rootProject.roomVersion"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:$rootProject.roomVersion"
// Test helpers
testImplementation "androidx.room:room-testing:$rootProject.roomVersion"

//paging
implementation "androidx.paging:paging-runtime:$rootProject.pagingVersion"
// RxJava support
//implementation "androidx.paging:paging-rxjava2:$rootProject.pagingVersion"

//NAVIGATION
implementation "android.arch.navigation:navigation-fragment-ktx:$rootProject.navVersion"
// use -ktx for Kotlin
implementation "android.arch.navigation:navigation-ui:$rootProject.navVersion"
androidTestImplementation "android.arch.navigation:navigation-testing-ktx:$rootProject.navVersion"

//WORK-MANAGER
implementation "android.arch.work:work-runtime-ktx:$rootProject.workVersion"
implementation "android.arch.work:work-firebase:$rootProject.workVersion"
androidTestImplementation "android.arch.work:work-testing:$rootProject.workVersion"

//RETROFIT
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"

//OkHttpInterceptor
implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttp3InterceptorVersion"

//GSON
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"

//GSON CONVERTER
implementation "com.squareup.retrofit2:converter-gson:$rootProject.gsonConverterVersion"

//RX JAVA RETROFIT ADAPTER
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.rxJavaAdapterVersion"

//SERIAL
implementation "com.twitter.serial:serial:$rootProject.serialVersion"

//MOCKITO
testImplementation "org.mockito:mockito-core:$rootProject.mockitoVersion"

//JETBRAINS ANNOTATION
implementation "org.jetbrains:annotations:$rootProject.jetBrainsAnnotationVersion"

//JUNIT 4
testImplementation "junit:junit:$rootProject.jUnitVersion"

// ANDROID JUNIT RUNNER AND JUNIT RULES
androidTestImplementation "com.android.support.test:runner:$rootProject.runnerVersion"
androidTestImplementation "com.android.support.test:rules:$rootProject.rulesVersion"
androidTestUtil "com.android.support.test:orchestrator:$rootProject.orchestratorVersion"

//ESPRESSO
androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$rootProject.espressoVersion"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$rootProject.espressoVersion"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:$rootProject.espressoVersion"

//androidTestImplementation "com.android.support.test.espresso:espresso-accessibility:$rootProject.espressoVersion"
implementation "com.android.support.test.espresso:espresso-idling-resource:$rootProject.espressoVersion"

//ROBO-ELECTRIC
testImplementation "org.robolectric:robolectric:$rootProject.roboElectricVersion"
}

Ответ 1

Я думаю, что вы должны попробовать добавить стиль, как показано ниже в вашем файле styles.xml. Для меня это сработало отлично, для подобного рода вопроса.

<style name="TextAppearance.AppCompat.Notification">
    <item name="android:textSize">12sp</item>
    <item name="android:textColor">?android:attr/textColorWhichYouWant</item>
</style>

Или вы можете использовать @style/TextAppearance.AppCompat.Notification с TextView в файле XML:

<TextView
    android:id="@+id/tvNotification"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:maxLines="1"
    android:text="Test notification"
    android:textAppearance="@style/TextAppearance.AppCompat.Notification" />

Пожалуйста, проверьте эту ссылку, Вы можете создать свой собственный макет уведомления.

Ответ 2

У меня была похожая проблема после обновления до Android Studio 3.2. Пожалуйста, обратитесь к этому ответу. Надеюсь, это работает для вас.