【发布时间】:2017-04-26 11:20:20
【问题描述】:
我正在开发安卓应用。我想更改状态文本的颜色。它也称为 textColorPrimary。但显示错误。
Error:(829, 21) No resource found that matches the given name: attr 'textColorPrimary'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
我的代码如下所示。
AndroidManifest.xml
<activity
android:name=".home.HomeActivity"
android:theme="@style/AppTheme.GrayStatusBar"/>
values\styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.GrayStatusBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimaryDark">@color/colorGray</item>
<item name="textColorPrimary">@color/bg</item>
</style>
</resources>
v21\styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
v17\styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
build.gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
android {
useLibrary 'org.apache.http.legacy'
}
defaultConfig {
applicationId "com.acs.udial"
minSdkVersion 16
targetSdkVersion 25
versionCode 15770
versionName "r15770"
testApplicationId "com.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
如何解决我的问题?请帮帮我?
【问题讨论】:
-
发给你
build.gradle.. -
也许您的 textColorPrimary 在测试包内?
-
@rafsanahmad007 我已经添加了问题。请检查一下。
-
@resw67 那么如何解决这个问题。
-
抱歉,我看到了。 DarkActionBar 首先有一个字段 textColorPrimary 吗?看看stackoverflow.com/questions/39070040/…