没有资源的发现,匹配给定的名字'机器人:Theme.Material.Light.DarkActionBar“ [英] No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'

查看:404
本文介绍了没有资源的发现,匹配给定的名字'机器人:Theme.Material.Light.DarkActionBar“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图改变我的HelloWorld应用全息主题Material.Light.DarkActionBar主题(如说通过什么新的Andr​​oid开发工具会话)。但我得到了下面的错误。我试图改变目标SDK版本为21,但我们没有21 SDK在SDK管理器。在那次会议上,他们说,为V-21设置风格的XML。

值/ styles.xml

 <资源>

    <! - 基本应用主题。 - >
    <样式名称=AppTheme父=机器人:Theme.Holo.Light.DarkActionBar>
        <! - 自定义你的主题在这里。 - >
    < /风格>

< /资源>
 

值-V21 / styles.xml

 < XML版本=1.0编码=UTF-8&GT?;
<资源>

    ! - 基本应用主题。 - >
    <样式名称=AppTheme父=机器人:Theme.Material.Light.DarkActionBar>
        <! - 自定义你的主题在这里。 - >
    < /风格>
< /资源>
 

build.gradle

 应用插件:com.android.application

安卓{
    compileSdkVersion 20
    buildToolsVersion20.0.0

    defaultConfig {
        的applicationIDcom.ramapps.helloworld
        的minSdkVersion 15
        targetSdkVersion 20
        版本code 1
        VERSIONNAME1.0
    }
    buildTypes {
        推出 {
            runProguard假
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'proguard-rules.pro
        }
    }
}

依赖{
    编译文件树(导演:库,包括:['的* .jar'])
}
 

错误:

 错误:错误检索父项:未发现的资源匹配给定名称机器人:Theme.Material.Light.DarkActionBar。
错误:执行失败的任务:应用程序:processDebugResources。
> com.android.ide.common.internal.LoggedErrorException:无法运行命令:
    /应用/ Android的Studio.app / SDK /集结工具/ Android为4.4W / AAPT包-f --no-紧缩-I /应用/ Android的Studio.app / SDK /平台/ Android为20 /的android.jar  - 中号/Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/manifests/debug/AndroidManifest.xml -S /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/res/debug -一个/Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/assets/debug -m -J /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/generated/source/r/debug -F /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/libs/app-debug.ap_ --debug模式--custom封装com.ramapps.helloworld -0 APK
  错误code:
    1
  输出:
    /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/res/debug/values-v21/values.xml:7:错误:错误检索父项:未发现的资源匹配给定名称机器人:Theme.Material.Light.DarkActionBar。
 

解决方案

您可以尝试在设定值 build.gradle 这样的(更新的API 21)

 安卓{
  compileSdkVersion 21
  buildToolsVersion21.1.1
  defaultConfig {
    的minSdkVersion 21 //还要看分钟的版本,你想支持
    targetSdkVersion 21
    版本code 1
    VERSIONNAME1.0
}
 

I try to change my HelloWorld Application holo theme to Material.Light.DarkActionBar theme(As said by What's new Android Development tools session). But I got following error. I try to change target SDK version is 21. But We didn't have 21 SDK in SDK Manager. In that session,they said,set style xml for v-21.

values/styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>

values-v21/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    !-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>
</resources>

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.ramapps.helloworld"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Error:

Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Applications/Android Studio.app/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /Applications/Android Studio.app/sdk/platforms/android-20/android.jar -M /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/manifests/debug/AndroidManifest.xml -S /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/res/debug -A /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/assets/debug -m -J /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/generated/source/r/debug -F /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/libs/app-debug.ap_ --debug-mode --custom-package com.ramapps.helloworld -0 apk
  Error Code:
    1
  Output:
    /Users/Ram_PC/Ram/MyDrive/My_Workspaces/Android_Studio_Workspace_L/HelloWorld/app/build/intermediates/res/debug/values-v21/values.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.

解决方案

You can try to set the values in the build.gradle like this (updated for API 21):

android {
  compileSdkVersion 21
  buildToolsVersion "21.1.1"
  defaultConfig {
    minSdkVersion 21 //Depends on the min version you would like to support
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}

这篇关于没有资源的发现,匹配给定的名字'机器人:Theme.Material.Light.DarkActionBar“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆