简体   繁体   English

找不到与给定名称“ Theme.AppCompat.Light”匹配的资源

[英]No resource found that matches the given name 'Theme.AppCompat.Light'

I am having problems setting up my eclipse program with Android for my first project. 我在为第一个项目使用Android设置Eclipse程序时遇到问题。 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. 将eclipse与android开发人员工具一起安装后,我尝试创建一个新的“ Android项目”,其最低sdk为Android 2.2,目标sdk为Android 6.0和sdk编译器为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". 单击运行后,Eclipse显示一个错误,表明我的空活动存在问题: 检索项目的父项时出错:未找到与给定名称'Theme.AppCompat.Light'相匹配的资源。大多数解决方案建议导入一个名为“ AppCompat-v7”的Android项目。 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. 我确保我的eclipse程序和所有android文件都在同一硬盘下,我尝试将文件添加到构建路径等,但是仍然存在相同的问题。 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. 下面有人评论建议我将“ AppCompat-v7”文件夹导入到程序包浏览器中,然后转到“ 项目”->“属性”以添加appcompat库文件夹。 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. 选中“ IsLibrary”框后,情况甚至如此。

AppCompat-v7 should be added to your module Gradle file. AppCompat-v7应该添加到模块Gradle文件中。 It goes in the dependencies section. 它在依赖项部分中。

For example: 例如:

dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   compile 'com.android.support:appcompat-v7:25.1.1'
   testCompile 'junit:junit:4.12'
}

if you have Appcompat v7 in your extras folder follow this link but if you don't have it: 如果您的Extras文件夹中有Appcompat v7,请单击以下链接,但如果没有:

To download the Support Library through the SDK Manager : 要通过SDK Manager下载支持库,请SDK Manager

  1. Start the Android SDK Manager. 启动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. 在“ SDK管理器”窗口中,滚动到“软件包”列表的末尾,找到Extras文件夹,然后展开以显示其内容。
  3. Select the Android Support 选择Android支持
  4. Repository item. 存储库项目。 Click the Install packages... button. 单击安装软件包...按钮。

在此处输入图片说明

After downloading, the tool installs the Support Library files to your existing Android SDK directory. 下载后,该工具会将支持库文件安装到您现有的Android SDK目录中。 The library files are located in the following subdirectory of your SDK: <sdk>/extras/android/m2repository/com/android/support/ directory. 库文件位于SDK的以下子目录中: <sdk>/extras/android/m2repository/com/android/support/目录。

Update: Import it like this picture 更新:像这张照片一样导入

在此处输入图片说明

you are now have your library in your project Explorer like this 您现在像这样在项目资源管理器中拥有库

在此处输入图片说明

the rest is adding library project 其余的是添加图书馆项目

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到与给定名称“ @ style / Theme.AppCompat.Light”匹配的资源 - No resource found that matches the given name '@style/Theme.AppCompat.Light' Android:找不到与给定名称匹配的资源:Theme.AppCompat.Light - Android: No resource found that matches the given name :Theme.AppCompat.Light 找不到与给定名称&#39;@ style / Theme.AppCompat.Light&#39;相匹配的资源 - No resource found that matche the given name '@style/Theme.AppCompat.Light' 找不到与给定名称匹配的资源:attr&#39;colorPrimary&#39;Theme.AppCompat.Light - No resource found that matches the given name: attr 'colorPrimary' Theme.AppCompat.Light 找不到与给定名称“ Theme.AppCompat.Light”匹配的资源。 Android Studio - No resource found that matches the given name 'Theme.AppCompat.Light'. Android Studio 寻求帮助:“错误:检索项目父项时出错:找不到与给定名称&#39;Theme.AppCompat.Light&#39;相匹配的资源” - Asking for help: “error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light' ” 检索项目的父项时出错:找不到与给定名称“Theme.AppCompat.Light”匹配的资源。 我的R.java失踪了 - Error retrieving parent for item:No resource found that matches the given name 'Theme.AppCompat.Light'. MY R.java is missing 键入错误:检索项目的父项时出错:未找到与给定名称&#39;Theme.AppCompat.Light&#39;匹配的资源。 styles.xml Android AAPT - Type error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml Android AAPT 如何修复Mac版的android eclips“错误检索父项:找不到与给定名称&#39;Theme.AppCompat.Light&#39;相匹配的资源? - How to fix mac version of android eclips 'Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'? 从Eclipse中的源代码创建Android项目:检索项目的父项时出错:未找到与给定名称&#39;Theme.AppCompat.Light&#39;匹配的资源 - Create Android project from source in Eclipse: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM