eclipse 当我使用新的 android 项目 appcompt 时显示错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26675627/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:09:15  来源:igfitidea点击:

when i am taking new android project appcompt is showing an error

androideclipse

提问by Rohit Bandil

before this error my all application are going fine but when i took new project suddenly it is showing error in my appcompat and in my project in build path in android dependency it is showing error.Pleas give me some solution what should I do. and also give me more clarity of android dependency and appcompat library file. it is showing this error:-

在此错误之前,我的所有应用程序都运行良好,但是当我突然使用新项目时,它在我的 appcompat 中显示错误,在我的项目中的 android 依赖项的构建路径中显示错误。请给我一些解决方案,我该怎么办。并且还让我更清楚地了解 android 依赖项和 appcompat 库文件。它显示此错误:-

appcompat_v7/res/values-v21/themes_base.xml:194: error: Error: No resource found that matches the given name: attr 'android:colorControlActivated'.
appcompat_v7/res/values-v21/themes_base.xml:195: error: Error: No resource found that matches the given name: attr 'android:colorControlHighlight'.
appcompat_v7/res/values-v21/themes_base.xml:193: error: Error: No resource found that matches the given name: attr 'android:colorControlNormal'.
appcompat_v7/res/values-v21/themes_base.xml:190: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
appcompat_v7/res/values-v21/themes_base.xml:191: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.

thanks

谢谢

采纳答案by Rohit Bandil

finally my error solveed but that is not exact solution what i wanted. what i did i have created one new project and took min sdk version is 15 bcoz action bar feature is present in 15 and further api .i think that feature introduced in 11 api .so i have taken new project with min sdk version and then no need of appcompat library now no error is coming... but i solved this problem by alternative solution but i also want answer of my question.

最终我的错误解决了,但这不是我想要的确切解决方案。我做了什么我创建了一个新项目并采用了最小 sdk 版本是 15 bcoz 操作栏功能存在于 15 和进一步的 api 中。我认为该功能是在 11 api 中引入的。所以我采用了最小 sdk 版本的新项目,然后没有现在需要 appcompat 库没有错误出现......但我通过替代解决方案解决了这个问题,但我也想回答我的问题。

回答by user3173628

you have not added the appcompat_v7 library properly

您没有正确添加 appcompat_v7 库

check whether you have the library in Right click your project->properties->select android->appcompact lib (this library should be refered you are missing this one) So follow these Steps:-

检查您是否拥有该库 右键单击​​您的项目-> 属性-> 选择 android->appcompact lib(该库应该是指您缺少此库)因此请按照以下步骤操作:-

1)Right-click your project and select Properties.

1) 右键单击​​您的项目并选择属性。

2)In the category panel on the left side of the dialog, select Android.

2) 在对话框左侧的类别面板中,选择 Android。

3)In the Library pane, click the Add button.

3) 在库窗格中,单击添加按钮。

4)Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.

4)选择库项目,点击确定。例如,appcompat 项目应列为 android-support-v7-appcompat。

5)In the properties window, click OK.

5) 在属性窗口中,单击确定。

If you don't see anything when you click Add button(step 3) ,then you should refer this link :-https://developer.android.com/tools/support-library/setup.html, in that link read adding libraries with resources and the follow the steps .

如果您在单击添加按钮(第 3 步)时没有看到任何内容,那么您应该参考此链接:- https://developer.android.com/tools/support-library/setup.html,在该链接中阅读添加带有资源的库,然后按照步骤操作。

OR

或者

Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a library project and ensure the required JAR files are included in the project's build path:
   1) Select File > Import.

    2)Select Existing Android Code Into Workspace and click Next.
    Browse to the SDK installation directory and then to the Support Library folder. 
    For example, if you are adding the appcompat project, 
    browse to <sdk>/extras/android/support/v7/appcompat/.

    3)Click Finish to import the project. For the v7 appcompat project,
   you should now see a new project titled android-support-v7-appcompat.

   4)  In the new library project, expand the libs/ folder,
   right-click each .jar file and select Build Path > Add to Build Path. 
   For example, when creating the the v7 appcompat project, 
   add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
   5) Right-click the library project folder and select Build Path > Configure Build  Path.

    6) In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
    Uncheck Android Dependencies.
   7) Click OK to complete the changes.

回答by Naveed

Yes this thing was coming to me too since too days. Go to your Project Properties and select that android api version that all things is downloaded with you in sdk for example in my case api 17 I choose and in sdk I have everything installed. Your project properties

是的,这件事也来找我了,因为太久了。转到您的项目属性并选择所有内容都在 sdk 中与您一起下载的 android api 版本,例如我选择的 api 17,在 sdk 中我已经安装了所有内容。 您的项目属性

I also did one thing extra in (image) bottom you can see check box (Is Library) I removed the refrence appcompat_v7 and click Apply.

我还在(图像)底部做了一件额外的事情,您可以看到复选框(是库)我删除了引用 appcompat_v7 并单击应用。

After this everyting work with me like charm..... At last I come to the point that

在这一切都像魅力一样与我一起工作之后......最后我来到了这一点

回答by arunprakashpj

appcompat_v7 -> project.properties ,I have changed the target =19 to target=21 . Then refreshed the project ,that fixed my issue.

appcompat_v7 -> project.properties ,我已将 target =19 更改为 target=21 。然后刷新了项目,解决了我的问题。

Reference: Got an error while building a project in new workspace

参考: 在新工作区中构建项目时出错