无法为新的Android ActionBar支持找到Theme.AppCompat.Light
本文翻译自:Can't Find Theme.AppCompat.Light for New Android ActionBar Support
I am trying to implement the new ActionBar support library that was released by Google a couple days ago. 我正在尝试实施Google几天前发布的新ActionBar支持库。 In the past, I have successfully implemented ActionBarSherlock without any issues using the same method listed on Google Developer's Support Library Setup page - using the guide on how to include the resources (which is similar to how ActionBarSherlock did it). 在过去,我使用Google Developer's Support Library Setup页面上列出的相同方法成功实现了ActionBarSherlock,没有任何问题 - 使用有关如何包含资源的指南(类似于ActionBarSherlock的工作方式)。 I have the library project loaded in to my own project as a library as well. 我将库项目作为库加载到我自己的项目中。
I can tell the library is loading fine. 我可以告诉图书馆加载正常。 When, instead of extending Activity on my MainActivity.java, I changed it to extend ActionBarActivity (as per Google's instructions), no errors occur - and it imports correctly. 什么时候,我没有在MainActivity.java上扩展Activity,而是将其更改为扩展ActionBarActivity(根据Google的说明),没有错误发生 - 并且它正确导入。
I even tried bypassing the style.xml file and adding @style/Theme.AppCompat.Light
directly in to the AndroidManifest.xml for both <application>
and <activity>
with android:theme="@style/ThemeAppCompat.Light"
with all attempts resulting in the same error. 我甚至尝试绕过style.xml文件并将@style/Theme.AppCompat.Light
直接添加到AndroidManifest.xml中,同时将<application>
和<activity>
与android:theme="@style/ThemeAppCompat.Light"
一起添加到所有尝试导致相同的错误。
Now the issue is I cannot get it to change the theme, let alone even build without throwing an error. 现在问题是我无法让它改变主题,更不用说甚至构建而不会抛出错误。 Below is the error I am receiving, followed by the style.xml file I changed to use the new theme. 下面是我收到的错误,后面是我更改为使用新主题的style.xml文件。
I have moderate experience working with Android apps and am running Eclipse with the latest version of the Support Libraries and SDK compiling with API 18 (Android 4.3). 我有使用Android应用程序的适度经验,并且使用最新版本的支持库和使用API 18(Android 4.3)编译的SDK运行Eclipse。
Error Received During Build 构建期间收到错误
error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Light'. 错误:检索项目的父项时出错:找不到与给定名称“@ style / Theme.AppCompat.Light”匹配的资源。 styles.xml /ActBarTest/res/values line 3 Android AAPT Problem styles.xml / ActBarTest / res / values line 3 Android AAPT问题
style.xml style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources><style name="Theme.ProsoftStudio.ACTest" parent="@style/Theme.AppCompat.Light"></style>
</resources>
Any suggestions? 有什么建议? This was never an issue with ActionBarSherlock. 这从来都不是ActionBarSherlock的问题。 I want to work on using this new support library. 我想继续使用这个新的支持库。 It almost seems like the .jar is loading, but not the resources. 几乎看起来.jar正在加载,但不是资源。
#1楼
参考:https://stackoom.com/question/1Cz21/无法为新的Android-ActionBar支持找到Theme-AppCompat-Light
#2楼
你需要参考$ ANDROID_SDK / extras / android / support / v7 / appcompat
#3楼
You need to do next: 你需要做下一个:
File->Import (android-sdk\\extras\\android\\support\\v7)
.File->Import (android-sdk\\extras\\android\\support\\v7)
。 Choose "AppCompat" 选择“AppCompat”Project-> properties->Android.
In the section library "Add" and choose "AppCompat" 在“添加”部分库中选择“AppCompat”- That is all! 就这些!
Note: if you are using "android:showAsAction" in menu item, you need to change prefix android as in the example http://developer.android.com/guide/topics/ui/actionbar.html 注意:如果您在菜单项中使用“android:showAsAction”,则需要更改前缀android,如示例http://developer.android.com/guide/topics/ui/actionbar.html
#4楼
I did the following in Eclipse with the Android Support Library ( APL ) project and the Main Project ( MP ): 我在Eclipse中使用Android支持库( APL )项目和主项目( MP )执行了以下操作:
Ensured both APL and MP had the same
minSdkVersion
andtargetSdkVersion
. 确保APL和MP具有相同的minSdkVersion
和targetSdkVersion
。Added APL as a build dependency for MP : 添加了APL作为MP的构建依赖项:
Going into "Properties > Java Build Path" of MP , and then 进入MP的 “属性> Java构建路径”,然后
Selecting the "Projects" tab and adding APL . 选择“项目”选项卡并添加APL 。
In the properties of MP , under "Android", added a reference to APL under library. 在MP的属性中,在“Android”下,在库下添加了对APL的引用。
1 and 2 got the references to Java classes working fine...however I still saw the error in the manifest.xml
for MP when trying to reference @style/Theme.AppCompat.Light
from APL . 1和2有到Java类的引用工作正常...但我还是看到了错误的manifest.xml
的MP尝试引用时@style/Theme.AppCompat.Light
从APL。 This only went away when I performed step 3. 当我执行第3步时,这只会消失。
#5楼
I will share my experience with this problem. 我将分享我对这个问题的经验。 I was going crazy because of this, but I found out that the problem was a bug with Eclipse itself, rather than my code: In eclipse, unable to reference an android library project in another android project 我因为这个而疯了,但我发现问题是Eclipse本身的一个错误,而不是我的代码: 在eclipse中,无法在另一个android项目中引用一个android库项目
So, if you have the Android Support Library in your C: drive and your project in the D: drive on your computer, Eclipse won't function correctly and won't know where the Android Support Library is (green tick turns into red cross). 因此,如果您的C:驱动器中有Android支持库,而您的项目位于计算机上的D:驱动器中,Eclipse将无法正常运行,并且无法知道Android支持库的位置(绿色勾号变为红叉)。 To solve this, you need to move both projects onto the same hard drive. 要解决此问题,您需要将两个项目移动到同一个硬盘驱动器上。
#6楼
Follow the steps of @rcdmk. 按照@rcdmk的步骤操作。 Delete the android support v4.jar in YOUR project. 删除您项目中的android支持v4.jar。 It conflicts with the new updated version found in appcompat. 它与appcompat中的新更新版本冲突。
无法为新的Android ActionBar支持找到Theme.AppCompat.Light相关推荐
- android android:theme.light,android – 我在哪里可以找到Theme.AppCompat.Light的默认样式?...
如果您使用的是 Android Studio,则可以轻松跟踪默认/内置资源/样式.按Ctrl键并将光标移到Theme.AppCompat.Light上,然后单击它将转到该values.xml文件. 你 ...
- Android ionic resource style/Theme.AppCompat.Light.NoActionBar (aka x.x.x:style/Theme.AppCompa
error: resource style/Theme.AppCompat.Light.NoActionBar (aka 包名:style/Theme.AppCompat.Light.NoAction ...
- Android安卓开发-'Theme.AppCompat.Light'无法找到的解决方案
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCom ...
- [android] No resource found that matches the given name 'Theme.AppCompat.Light'
在整合android过程中导入别人的项目出现下面的错误: <style name="AppBaseTheme" parent="Theme.AppC ...
- Android Studio出现Error:resource style/Base.V25.Theme.AppCompat.Light、aapt2.Aapt2Exception: AAPT2 erro
Android Studio出现"Error:resource style/Base.V25.Theme.AppCompat.Light"和"Error:java.uti ...
- Android问题集锦之三十七:No resource found 'Theme.AppCompat.Light.DarkActionBar'
AS导入他人的工程会遇到这样那样的问题. 如果他们用的AS版本比较老,那么需要AS会自动下载相对应版本的gradle.这个我在前几篇文中有提过.不过最简单的版本就是直接将gradle的版本改成最新. ...
- 【Android】Theme.AppCompat.Light 问题
Android 开发的 styles.xml 文件中遇到了这个问题: <style name="AppBaseTheme" parent="Theme.AppCom ...
- Android报错:No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'
报错: test/res/values/styles.xml:4: error: Error retrieving parent for item: No resource found that ma ...
- Android “Theme.AppCompat.Light”解决方法
1.报错 styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> ...
最新文章
- 关于JQuery中的ajax请求或者post请求的回调方法中的操作执行或者变量修改没反映的问题...
- 玩音乐,敲架子鼓,一个被“耽误了”的机器学习高手
- 最近的学习---一句话收获(备查用)(3)
- CPU占用率高的九种可能~
- 【MyBatis】MyBatis对Log4J的支持、MyBatis实现新增、删除、修改、查询
- mybatisplus 操作另一个数据库的数据_MySQL数据库的基础操作
- javascript在asp.net中运用
- 基于ssm公租房管理系统
- 学士后java单元项目答案_北大青鸟学士后java工程师第二单元项目源代码
- C# AutoCAD图纸插入块(另一个dwg文件)
- [10]STM32程序调试方法-STLINK调试和软件调试
- 可见首发《模式识别与智能计算:MATLAB技术实现(第2版)》 百度网盘 下载 分享
- PLS-00103: Encountered the symbol “DECLARE“
- 全国计算机二级ms备考,全国计算机二级MS office经验分享
- office@word官方文档查看@审阅@批注@修订
- 如何防止亚马逊账号被关联?
- Android kotlin 大全
- kafka一些常用命令,以及如何查看消息被谁消费了
- 中国企业级HTML5产业联盟成立 巨头联手共建新移动生态
- 基于javaweb+SpringBoot的在线蛋糕销售商城蛋糕店(java+JSP+Springboot+maven+mysql+ThymeLeaf+FTP)