web-dev-qa-db-ja.com

出力:エラー:リソースstyle / TextAppearance.Compat.Notification.Info(別名package_name:style / TextAppearance.Compat.Notification.Info)が見つかりません

Android Studio 3.2カナリアに切り替えた後、次のビルドエラーが発生します。

私は this 投稿を見ましたが、その男は同様の問題を抱えていましたが、解決策については言及されていませんでした。

新しい素材のコンポーネントとジェットパックを試したいので、元に戻す必要がない可能性はありますか。

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"
}
13
Nikhil Soni

styles.xmlファイルに以下のようにスタイルを追加してみてください。私にとっては、同様の問題で完璧に機能しました。

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

または、XMLファイルで@style/TextAppearance.AppCompat.NotificationTextViewとともに使用できます。

<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" />

これを確認してください リンク 、カスタム通知レイアウトを作成できます。

4
Deep Patel

私自身、これはAndroidXに移行した後に発生しました。私は、style="@style/TextAppearance.AppCompat.Notification.Info"style="@style/TextAppearance.AppCompat.Title"に変更しました。少なくとも、ビューの出力は問題ありません。 AndroidX以前との違いは見つかりませんでした。

テストするまでは、私のソリューションを回避策と見なすことができます。

0
Atef Farouk