【问题标题】:Android - Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitleBackground'Android - 检索项目的父项时出错:找不到与给定名称“android:WindowTitleBackground”匹配的资源
【发布时间】:2017-02-04 06:25:05
【问题描述】:

我将一个旧的 Eclipse 项目导入到 Android Studio 中,我正在尽最大努力让它编译,同时仍然支持 SdkVersion 4。

build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion '21.0.0'

    defaultConfig {
        applicationId "com.name.name"
        minSdkVersion 4
        targetSdkVersion 21
    }

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

dependencies {
    compile 'com.android.support:support-v4:21.0.0'
}

错误:

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
C:\Users\me\WORK\ORIGINAL\original_gradle_made\app\build\intermediates\res\merged\debug\values\values.xml
Error:(206) Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitleBackground'.
Error:(206) Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitleBackground'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

有人知道我缺少什么或需要更改吗?

【问题讨论】:

  • minSdkVersion 4 不确定是否存在 2017 年您的目标受众太多,至少使用 14 或 15 // 为什么要将 min 用作 4 ?如果对我来说似乎是一个框架错误@_@

标签: android eclipse android-studio merge android-support-library


【解决方案1】:

尝试将 targetSdkVersion 21 更改为 -> targetSdkVersion 13 。然后cleanrebuild 项目。

【讨论】:

  • 请编辑您的答案。应该是minSdkVersion
  • @IntelliJAmiya 从其他一些答案中,我发现问题可能是由设置更高的目标 sdk 引起的,我正在等他尝试看看它是否有效!
  • @OBX 我尝试将 targetSdkVersion 更改为 13,但没有任何变化。我还尝试更改minSdkVersion
【解决方案2】:

我用我需要的选项创建了一个新项目。我将 v4 支持添加到 build.gradle 文件中,并将其复制并粘贴到现有项目中,它解决了我的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-27
    • 2014-06-04
    • 2017-02-10
    • 2017-06-27
    • 2017-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多