没有资源发现在给定的名字相匹配,并且无法执行AAPT
我尝试建立一个项目,但是......没有资源发现在给定的名字相匹配,并且无法执行AAPT
信息:摇篮任务[assembleDebug] d:\ myGitHub \ AndroidDemo \演示\建立\中间体\ res \ merged \ debug \ values \ values.xml 错误:(719,21)找不到与给定名称匹配的资源:attr'preferenceTheme'。 错误:(719,21)找不到与给定名称匹配的资源:attr'preferenceTheme'。 错误:执行失败的任务':Demo:processDebugResources'。
com.android.ide.common.process.ProcessException: Failed to execute aapt Information:BUILD FAILED Information:Total time: 1.655 secs Information:3 errors Information:0 warnings Information:See complete output in console
def conf = rootProject.ext.version
def libs = rootProject.ext.dependencies
android {
compileSdkVersion conf.compileSdkVersion
buildToolsVersion conf.buildToolsVersion
defaultConfig {
applicationId "com.surcreak.androiddemo"
minSdkVersion conf.minSdkVersion
targetSdkVersion conf.targetSdkVersion
versionCode conf.versionCode
versionName conf.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext {
version = [
compileSdkVersion : 26,
buildToolsVersion : "26.0.1",
minSdkVersion : 19,
targetSdkVersion : 26,
versionCode : 1,
versionName : "1.0"
]
dependencies = [
"appcompat-v7" : "com.android.support:appcompat-v7:26.+",
"recyclerview" : "com.android.support:recyclerview-v7:26.+",
"constraint-layout" : "com.android.support.constraint:constraint-layout:1.0.2",
"dexter" : "com.karumi:dexter:4.1.0"
]
}
我怎样才能解决这个任何解决方案?谢谢。
您是否将此用于PreferenceFragment
?如果是这样,请确保您包含相应的支持库。
https://developer.android.com/topic/libraries/support-library/packages.html#v7-preference
你在哪里使用属性preferenceTheme?根据名称,它似乎应该在styles.xml但IDE试图找到它在values.xml。我猜你的代码有问题。
值文件夹下的所有资源,建成一个'values.xml'中间文件。这似乎不是问题。 –
是的。我忘了添加“com.android.support:preference-v7:26.+”。谢谢。 – user3059882