Gradle建筑没有找到attr风格

时间:2014-11-26 19:41:26

标签: android gradle styles attr

最近我遇到了一个错误,但最糟糕的是:我什么都没做! 当项目构建所有gradle文件时,我收到此错误日志:

  

错误:(3,6)找不到与给定名称匹配的资源:attr' style'。

     

错误:(3,6)任务执行失败':hiperCotacao:processDebugResources'。   com.android.ide.common.internal.LoggedErrorException:无法运行命令:       C:\ Development \ java-dev \ sdk \ build-tools \ 21.0.2 \ aapt.exe包-f --no-crunch -IC:\ Development \ java-dev \ sdk \ platforms \ android-21 \ android。 jar -MC:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ intermediates \ manifests \ full \ debug \ AndroidManifest.xml -SC:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ intermediates \ res \ debug -AC:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ intermediates \ assets \ debug -m -JC:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ generated \ source \ r \ debug -FC:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ intermediates \ res \ resources-debug.ap_ --debug-mode --custom-package trilha.hipercot.activities -0 apk - output-text-symbols C:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ intermediates \ symbols \ debug   错误代码:       1   输出:       C:\ Development \ java-dev \ projects \ HiperCotacao \ hiperCotacao \ build \ intermediates \ res \ debug \ values \ values.xml:1431:错误:错误:找不到与给定名称匹配的资源:attr' style& #39;

我使用:

  

Android Studio 1.0 RC 1
  构建工具v21.1.1
  Min SDK Ver:8
  目标SDK版本:21
  使用support-appcompat v4,v7。还有RecyclerView,CardView(所有Maven资源)
  Gradle版本:2.1
  Android插件版本:0.14.4

这是' build.gradle'文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.1'

    defaultConfig {
        applicationId "trilha.hipercot.activities"
        minSdkVersion 8
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':recyclerviewstickysection')
    compile project(':androidsupportv4preferencefragment')
    compile files('libs/ormlite-android-4.48.jar')
    compile files('libs/ormlite-core-4.48.jar')
    compile 'com.android.support:support-v4:21.0.2'
    compile 'com.android.support:appcompat-v7:21.0.2'
    compile 'com.android.support:recyclerview-v7:21.0.2'
    compile 'com.android.support:cardview-v7:21.0.2'
}

错误指向:

<style name="Theme.HiperCotacao" parent="@style/Theme.AppCompat.Light">
    //...
</style>



修改

解决了问题 这是我的&#34; styles.xml&#34;上的一行。 这样的事情:

<item name="style">?attr/selectableItemBackground"</item>

奇怪的部分是:它没有针对问题的正确部分进行选择。 之后:

<item name="android:foreground">?attr/selectableItemBackground</item>

1 个答案:

答案 0 :(得分:1)

您无法在样式中使用样式。另一种解决方案可能是将其他样式添加为父级。