Android appcompat v7错误 [英] Android appcompat v7 error

查看:242
本文介绍了Android appcompat v7错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的Android开发我遵循最简单的教程,构建了一个新的android项目,接受所有默认设置(为kitkat构建)。令我感到沮丧的是,我有一个未规划的项目 - appcompat_v7 ,以及错误:


容器Android Dependencies引用不存在的库
'C:\Users ... \workspace\appcompat_v7\bin\appcompat_v7.jar'


和以下两个


只有构建路径错误才能构建项目解决


有一个快速的方法来解决这些问题?
这是一个多么困难的迹象,并且在学习Android将会出现令人不快的惊喜吗?



(希望它不会类似于学习IOS 6几年前...)

解决方案

appcompat_v7 默认在Eclipse的Android项目中。您最有可能需要您开始制作的任何演示项目。



要正确添加此库,请按照下列步骤操作:



对于Android Studio



1。确保您拥有



2。 .gradle 文件,包括以下编译语句

  compile'c​​om.android.support:appcompat-v7:+'

依赖新生



3。使用同步项目执行Gradle同步 code>按钮。






对于Eclipse:



诀窍是,你需要清洁&构建 appcompat_v7 项目。转到

 项目 - >选择清洁 - >选择项目。 

执行此操作后,如果项目未自动构建,请右键单击包中的项目浏览器并选择 Build Project 。现在,项目的 bin 文件夹中将生成 .jar 文件。之后,清洁&构建引用 appcompat_v7 的所有项目。



现在,所有需要的项目都应正确引用库。 / p>

另请注意:




  • 您必须最新版本的 SDK工具 / 构建工具
    / 平台工具。如果您尝试此操作并且不起作用,请转到Android SDK Manager的
    ,并确保您有最新版本的
    所需的工具。

  • 如果您的项目只需要API级别14(冰淇淋三明治)
    &在创建新项目时,在
    项目向导中为最低要求的SDK选择API级别14。现在,该项目不需要appcompat_v7
    库,应用程序
    将使用AOSP中存在的本地ActionBar类,从ICS开始构建



更多参考资料



1。 如何在eclipse中添加Android支持v7库



2。 Android操作栏如何添加支持库v7 appcompat for Eclipse



3。 android-support-v7-appcompat库项目将无法正常工作



4。 > android-support-v7-appcompat和android-support-v4之间的区别


Being new to Android developent I followed the simplest of tutorials, built a new android project, accepting all default settings (built it for kitkat). To my dismay I have an un-planned project - appcompat_v7, along with the errors:

The container 'Android Dependencies' references non existing library 'C:\Users...\workspace\appcompat_v7\bin\appcompat_v7.jar'

and twice the following

The project cannot be built until build path errors are resolved

Is there a quick way to fix these? Is this a sign of how difficult, and bugged with unpleasant surprises learning Android is going to be?

(Hope it will not be similar to learning IOS 6 years ago...)

解决方案

The appcompat_v7 library is added by default in an Eclipse Android project. You will most likely need it for any demo projects you start making.

To correctly add this library, follow these steps

For Android Studio:

1. Ensure that you have the Android Support Repository installed in your SDK Manager:

2. In your build.gradle file, include the following compile statement

compile 'com.android.support:appcompat-v7:+'

in the dependency bracket.

3. Perform a Gradle sync with the Sync Project button.


For Eclipse:

The trick is, you need to clean & build the appcompat_v7 project. Go to

Project -> select Clean -> select the project. 

After doing this, if the project does not get built automatically, right click on the project in the package explorer and select Build Project. Now the .jar file will be generated in the project's bin folder. After that, clean & build all projects that reference appcompat_v7.

Now the library should be correctly referenced by all projects that need it.

Note also that:

  • You must have the latest versions of SDK Tools / Build Tools / Platform Tools. If you try this and it doesn't work, then go to the Android SDK Manager and make sure you have the latest versions of the required tools.
  • In case your project only requires API level 14 (Ice Cream Sandwich) & above, select API level 14 for "minimum required SDK" in the project wizard when you create a new project. Now the appcompat_v7 library will not be required for this project, and the application will use the native ActionBar class which is present in AOSP builds from ICS onwards.

Further References:

1. How to add Android Support v7 libraries in eclipse.

2. Android actionbar how to add supporting library v7 appcompat for Eclipse.

3. android-support-v7-appcompat library project won't work.

4. Difference between android-support-v7-appcompat and android-support-v4.

这篇关于Android appcompat v7错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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