Android支持 - 库

时间:2014-03-22 16:14:32

标签: android eclipse android-support-library

我已经为4.1.2创建了一个Android应用程序,我想要2.2版本。

我使用的是PopupMenu类,2.2中没有支持。我搜索了Google,发现我必须将android-support-v7-appcompat项目导入Eclipse。

在我的项目BuchAppZweiPunktZwei中,我已将此库设置为参考。我还在android-support-v7-appcompat项目中将support-appcompat.jar添加到了我的Build-Path。

我收到以下错误:

[2014-03-22 17:10:04 - BuchAppZweiPUNKTZwei] C:\Users\Pascal\Downloads\adt-bundle-windows-x86_64-20130917\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.
[2014-03-22 17:10:04 - BuchAppZweiPUNKTZwei] C:\Users\Pascal\Downloads\adt-bundle-windows-x86_64-20130917\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:28: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar'.
[2014-03-22 17:10:04 - BuchAppZweiPUNKTZwei] C:\Users\Pascal\Downloads\adt-bundle-windows-x86_64-20130917\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:32: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.Solid'.

等等。

有人可以告诉我如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

首先,不要创建v7 appcompat项目的jar;只需将其作为项目库包含在您自己的项目中。

其次,根据the documentation on the use of v7 appcompat

  

注意:此库取决于v4支持库。如果您使用的是Ant或Eclipse,请确保将v4支持库包含在此库的类路径中。

最后,请确保your application is using the AppCompat theme

<application ... android:theme="@style/Theme.AppCompat">
    ...
</application>