检索项目的父项时出错 - Android Studio

时间:2014-06-27 23:34:08

标签: android android-studio

在尝试刷新,构建或清理项目时下载New L SDK和20 SDK后,我得到了

Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.

这是我的build.gradle

apply plugin: 'com.android.application'
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}

repositories {
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}


    signingConfigs{
        release {
           ... Stuff Here ...
        }
    }
    buildTypes {
        debug {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            zipAlign true
            debuggable true
        }
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            zipAlign true
            signingConfig signingConfigs.release

        }
    }

    dexOptions {
        incremental true
    }
}

android {
    compileSdkVersion 'android-L'
    buildToolsVersion '20.0.0'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 'L'
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    ...
    Some Projects
    ...
    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.android.support:appcompat-v7:+'
}

我觉得我已经尝试了一切,我不知道还有什么可以尝试。 任何帮助将不胜感激。

我刚从0.6.0 Canary升级到新的Android Studio Beta(0.8.0)

5 个答案:

答案 0 :(得分:40)

事实证明我必须制作目标并将版本编译为L,这意味着我无法在较旧的SDK上运行我的应用程序。如果您希望您的应用程序在SDK 19及更低版本上运行,则必须将您的编译和目标版本设置为19,并将您的min SDK设置为您需要的任何版本。

接下来,您必须将导入调整为与您选择编译的SDK兼容的版本。例如,如果要在sdk 19上使用v7支持库,则必须像下面这样导入它:compile compile' com.android.support:appcompat-v7:20。+'

答案 1 :(得分:9)

试试这个:

    android {
        compileSdkVersion 20
        buildToolsVersion '19.1.0'

        defaultConfig {
            minSdkVersion 14
            targetSdkVersion 20
        }
    }
    dependencies {
        compile 'com.android.support:appcompat-v7:19.+'
    }

如果您的项目中有另一个模块,请检查这些模块中的清单文件。

答案 2 :(得分:1)

只需将您的compileVersion设置为19,并确保您没有使用最新的兼容性库(坚持使用版本19.1.0)。这对我有用。

答案 3 :(得分:1)

如果在尝试将兼容性库与资源(例如:v7支持库)一起使用时,在 Eclipse 中出现类似错误,则:
右键单击库项目文件夹(例如:android-support-v7-appcompat)
选择属性
在对话框左侧的类别面板中,选择 Android
项目构建目标中,检查与项目中相同的平台版本

答案 4 :(得分:0)

在Android Studio中,除非我编译并定位相同版本(在这种情况下为23),并添加了特定的Google引用来编译Google API,否则上述情况无效。从Eclipse导入和更新后修复了所有99个错误:

compileSdkVersion 'Google Inc.:Google APIs:23'