找不到与给定名称匹配的资源并且无法执行 aapt
No resource found that matches the given name and Failed to execute aapt
我尝试建立一个项目,但是...
信息:Gradle 任务 [assembleDebug]
D:\myGitHub\AndroidDemo\Demo\build\intermediates\res\merged\debug\values\values.xml
错误:(719, 21) 找不到与给定名称匹配的资源:attr 'preferenceTheme'。
错误:(719, 21) 找不到与给定名称匹配的资源:attr 'preferenceTheme'。
Error:Execution 任务“: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"
]
}
我该如何解决这个问题?谢谢
您在哪里使用 preferenceTheme 属性?根据名称,它似乎应该在 styles.xml 但 IDE 试图在 values.xml 中找到它。我猜你的代码有问题。
您是否将此用于 PreferenceFragment
?如果是这样,请确保包含相应的支持库。
https://developer.android.com/topic/libraries/support-library/packages.html#v7-preference
我尝试建立一个项目,但是...
信息:Gradle 任务 [assembleDebug] D:\myGitHub\AndroidDemo\Demo\build\intermediates\res\merged\debug\values\values.xml 错误:(719, 21) 找不到与给定名称匹配的资源:attr 'preferenceTheme'。 错误:(719, 21) 找不到与给定名称匹配的资源:attr 'preferenceTheme'。 Error:Execution 任务“: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"
]
}
我该如何解决这个问题?谢谢
您在哪里使用 preferenceTheme 属性?根据名称,它似乎应该在 styles.xml 但 IDE 试图在 values.xml 中找到它。我猜你的代码有问题。
您是否将此用于 PreferenceFragment
?如果是这样,请确保包含相应的支持库。
https://developer.android.com/topic/libraries/support-library/packages.html#v7-preference