放弃支持库v7。我错了什么? [英] Giving up on support library v7. What did I wrong?

查看:308
本文介绍了放弃支持库v7。我错了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要添加2.3及更高版本的操作栏。



我最近知道appcompat v7支持库,正是这样。

我遵循了支持库安装指南,逐步清理,构建和清理,重新启动eclipse,升级SDK和插件到最后一个版本(只是为了实现 SDK构建工具v19已损坏,所以我不得不删除它们)。两个小时后,我仍然无法建立我的项目。我收到以下错误:

  [2013-11-13 00:00:00  -  FooProject] D:\foo_project \android-support-v7-appcompat\res\values-v11\themes_base.xml:33:错误:错误:找不到符合给定名称的资源:attr'android:windowActionBar'。 
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:42:error:检索项目的父项时出错:找不到符合给定名称android:Theme.Holo.Light的资源。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:44:错误:错误:找不到符合给定名称的资源:attr'android:windowActionBar'。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:31:error:检索项目的父项时出错:找不到符合给定名称android:Theme.Holo的资源。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:41:错误:错误:找不到匹配给定名称的资源:attr'android:actionBarWidgetTheme'。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:57:error:检索项目的父项时出错:找不到符合给定名称android:Theme.Holo.Light的资源。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:67:error:错误:找不到匹配给定名称的资源:attr'android:actionBarWidgetTheme'。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:83:错误:检索项目的父项时出错:找不到符合给定名称android:Theme.Holo.Light.DarkActionBar的资源。
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:94:error:错误:找不到匹配给定名称的资源:attr'android:actionBarWidgetTheme'。

我在以下问题中尝试过一切,无济于事:

将支持库添加到Android项目 _
设置android-support-v7-appcompat后R.java缺少

Android支持库v7:检索项目的父项时错误 _
无法找到适用于新的Android ActionBar支持的Theme.AppCompat.Light

如何解决错误找不到匹配给定名称的资源在Eclipse中添加库v7 AppCompat时



我不是说这些答案是无效的,只是因为某些原因他们没有对我而言(我认为这是因为Google讨厌我)。



这是目标sdk的清单行:



对于图书馆:

 < uses-sdk android:minSdkVersion =7/> ; 

和主项目:

 < uses-sdk android:targetSdkVersion =19android:minSdkVersion =8/> 

尝试每次更改后的所有可能组合,清洁和建造,仍然没有运气。



看起来这是一个与Holo有关的问题。我真的不需要Holo,只有ActionBar。现在我只是切换到ActionBarSherlock,这对我来说过去很好。但是,我真的很想知道我做错了什么,为什么有些事情在研究这个问题上花费了相当多的时间。为什么整合一个可以开箱即用的库的这么多的痛苦。



是否可以使用支持v7库获取ONLY操作栏?

解决方案

最终让它工作。



添加ActionBarSherlock时,同样的错误



我已经编辑了 project.properties 文件(是的,那个与评论该文件由Android Tools自动生成,不要修改此文件 - 您的更改将被删除)
构建目标设置为8,更改为16,现在它同时与ABS和appcompat v7 。



更新:

以下是正确的方法:
https://stackoverflow.com/a/3343050/813951


I need to add the action bar for devices 2.3 and higher.

I recently knew about the appcompat v7 support library, which does exactly that.

I've followed the Support library setup guide, step by step, cleaned, built, and cleaned again, restarted eclipse, upgraded SDK and plugin to the last version (just to realise that SDK build tools v19 are broken, so I had to delete them). Two hours later I'm still unable to build my project. I'm getting these errors:

    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:33: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:42: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:44: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:31: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:41: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:57: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:67: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
    [2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:94: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.

And I've tried everything in the following questions, to no avail:
Adding Support Libraries to Android project
After setting up android-support-v7-appcompat R.java is missing
Android Support Library v7: Error retrieving parent for item
Can't Find Theme.AppCompat.Light for New Android ActionBar Support
How to resolve the error "No resource found that matches the given name" when adding library v7 AppCompat in Eclipse?

I'm not saying those answers are not valid, just that for some reason they didn't work for me (I think it's because Google hates me).

Here are my manifest lines for the target sdk:

For the library:

<uses-sdk android:minSdkVersion="7"/>

and for the main project:

<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="8"/>

Tried every possible combination, cleaning and building after each change, and still no luck.

Looks like this is a problem related to Holo. I really don't need Holo at all, only ActionBar. For now I'm just switching to ActionBarSherlock, which worked well for me in the past. But I'd really like to know what am I doing wrong, why something does not work despite I've spent a considerable ammount of time researching the issue. Why so much pain in integrating a library that should be usable out of the box.

Is it possible to get ONLY action bar with the support v7 library?

解决方案

Finally got it working.

When adding ActionBarSherlock, the same kind of errors where appearing in the console.

I've edited the project.properties file (yeah, that one with the comment "This file is automatically generated by Android Tools. Do not modify this file -- YOUR CHANGES WILL BE ERASED") Build target was set to 8, changed it to 16 and now it compiles with both ABS and appcompat v7.

UPDATE:
Here's how to do it the right way: https://stackoverflow.com/a/3343050/813951

这篇关于放弃支持库v7。我错了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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