在切换到AndroidStudio 3.2 canary之后,我得到了以下构建错误。
我看过这篇文章,里面的人也有类似的问题,但没有提到解决方案。
我想尝试新的材料组件和喷气背包,所以有没有可能我不必切换回来。
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.
建筑格拉德尔
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"
}
就我自己而言,这是在迁移到AndroidX后发生的,我将style=“@style/textAppAppAppAppearance.Notification.Info”
更改为style=“@style/textAppAppearance.AppCompat.Title”
,并且视图的输出至少对我来说是好的。我没有发现和以前的AndroidX有什么不同。
在测试之前,您可以将我的解决方案视为一种解决方案。
我认为你应该尝试在你的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。通知
和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" />
请检查此链接,您可以创建自定义通知布局。
我正在尝试构建一个包含compileSdkVersion 25和targetSdkVersion 25的项目,但我需要将两者都更改为23,因此在更改compileSdkVersion 23和targetSdkVersion 23后,我会收到一个错误 错误:资源android:样式/文本外观。布料小装置。按钮无国界。没有找到。错误:资源android:样式/文本外观。布料小装置。按钮没有找到。错误:
我正在使用 我都工作得很好。我可以构建签名APK并在Android Studio中运行它们。我可以在模拟器和真实设备上运行该项目。事情就是这样。 但是我正在尝试在这个项目上设置Fastlane,所以我需要运行。这就是我得到标题错误的时候。 Android资源链接失败/home/cescoferraro/go/src/github.com/onnidev/astaff/base/build/inte
通知 - Notification 不要把这里的通知和推送通知或者本地通知搞混了,这里的通知是基于订阅-发布模型的,即一个对象 (发布者) 向其他对象 (订阅者) 发送消息。发布者永远不需要知道订阅者的任何数据。 Apple 对于通知的使用很频繁,比如当键盘弹出或者收起的时候,系统会分别发送 UIKeyboardWillShowNotification/UIKeyboardWillHideNoti
基础文本样式 <div class="content-padded"> <h1>标题一</h1> <h2>标题二</h2> <h3>标题三</h3> <h4>标题四</h4> <h5>标题五</h5> <h6>标题六</h6> <p>这是一个段落</p> </div>
文本类组件共享一些通用样式, 这类组件目前包括 <text>、<input>和<richtext> 属性 color color {color}:文字颜色,支持如下字段: * RGB( rgb(255, 0, 0) ) * RGBA( rgba(255, 0, 0, 0.5) ) * 十六进制( #ff0000 );精简写法的十六进制( #f00 ) * 色值关键字(red) font-size
主要内容:介绍,实现,Shape.java,Rectangle.java,Square.java,Circle.java,ShapeMaker.java,FacadePatternDemo.java外观模式(Facade Pattern)隐藏系统的复杂性,并向客户端提供了一个客户端可以访问系统的接口。这种类型的设计模式属于结构型模式,它向现有的系统添加一个接口,来隐藏系统的复杂性。 这种模式涉及到一个单一的类,该类提供了客户端请求的简化方法和对现有系统类方法的委托调用。 介绍 意图:为子系统中的