找不到符合给定名称“Theme.AppCompat.Light”的资源 [英] No resource found that matches the given name 'Theme.AppCompat.Light'

查看:357
本文介绍了找不到符合给定名称“Theme.AppCompat.Light”的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在第一个项目中使用Android设置我的eclipse程序时遇到问题。在安装eclipse之后,我们一起安装了Android开发工具,我试图用Android 2.2的最低sdk,Android 6.0的目标sdk和Android 7.1.1的sdk编译器来创建一个新的Android项目。



在单击运行后,Eclipse显示一个错误,表示存在我的空活动的问题:
检索项目的父项时出错:找不到符合给定名称的资源'Theme.AppCompat.Light'
我已经完成了我对这个问题的研究,大多数解决方案建议导入一个称为AppCompat-v7的Android项目。但是,选择文件后,没有找到可以导入的项目。这是我看到的:
导入项目窗口:





我花了好几个小时试图解决这个问题。我已经确保我的eclipse程序和所有的安卓文件在同一个硬盘下,我已经尝试将文件添加到构建路径等,但同样的问题仍然存在。
有谁可以帮助我解决这个问题吗?我会非常感谢它:)如果你需要更多的细节,我已经做了迄今为止,请随时与我联系。



有人评论以下建议我导入 AppCompat-v7文件夹,然后转到项目 - >属性添加appcompat库文件夹。我设法将文件夹添加到我的软件包资源管理器,但是我无法将库添加到项目中,因为没有库选项显示。检查IsLibrary框后,这样即可。

解决方案

如果您的附件文件夹中有Appcompat v7,请按照



下载后,该工具将支持库文件安装到现有的Android SDK目录中。库文件位于SDK的以下子目录中:

$ / b
$ b

更新:像这张图片一样导入





你现在在你的项目资源管理器中有这样的



其余的是添加库项目


I am having problems setting up my eclipse program with Android for my first project. After installing eclipse together with the android developer tools, I tried to create a new 'Android Project' with a minimum sdk of Android 2.2, a target sdk of Android 6.0 and a sdk compiler of Android 7.1.1.

After clicking run, Eclipse displayed an error, which indicated that there was issues with my empty activity: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light' I have done my research for this problem and most of the solutions suggested importing an Android Project called "AppCompat-v7". However, upon selecting the file, there were no projects found that could be imported. This is what I see: Import project window:

I have spent numerous hours trying to fix this issue. I have ensured that both my eclipse program and all android files are under the same hard disk, I have tried adding the file to the build path etc. but the same problem persists. Anyone out there who can help me with this issue please? I would greatly appreciate it :) If you need more details regarding what I have done so far, feel free to contact me!

Someone commented below suggesting that I import the "AppCompat-v7" folder to the package explorer and then go to Project->Properties to add the appcompat library folder. I managed to add the folder to my package explorer but I am not able to add the library to the project, as no library options show up. This is even so after checking the "IsLibrary" box.

解决方案

if you have Appcompat v7 in your extras folder follow this link but if you don't have it:

To download the Support Library through the SDK Manager:

  1. Start the Android SDK Manager.
  2. In the SDK Manager window, scroll to the end of the Packages list, find the Extras folder and, if necessary, expand to show its contents.
  3. Select the Android Support
  4. Repository item. Click the Install packages... button.

After downloading, the tool installs the Support Library files to your existing Android SDK directory. The library files are located in the following subdirectory of your SDK: <sdk>/extras/android/m2repository/com/android/support/ directory.

Update: Import it like this picture

you are now have your library in your project Explorer like this

the rest is adding library project

这篇关于找不到符合给定名称“Theme.AppCompat.Light”的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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