如何删除支持库(appcompat_v7)的Eclipse] [英] How to remove support library (appcompat_v7) [Eclipse]

查看:163
本文介绍了如何删除支持库(appcompat_v7)的Eclipse]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经更新了我的Eclipse和ADT插件到最新版本,最近和公认的一些大的变化。每当我创建一个新的Andr​​oid应用程序项目似乎这是以前没有present,也是一个fragment_main.xml新appcompat_v7库。这是为什么?为什么activity_main.xml文件中没有preferred的活动布局直接了,为什么appcompat库现在包括在每一个项目?我试图删除日食/ ADT / SDK很多次,从SDK管理器中删除的支持库,但没有得到结果!我知道它是与动作条,但问题是,每当我创建一个新项目一个红色的感叹号显示了这两个项目的文件,appcompat_v7文件,这$ P $上pvents我从编译/运行的应用程序,甚至有时appcompat_v7文件不创建和我得到的唯一一件事就是损坏的code这里有一个画面: HTTP://i.stack .imgur.com / XJMfW.png

让我怎么能消除这种依赖关系,并感谢

解决方案
  

这是为什么?

由于谷歌的工程师补充说一套,新活动模板,至少在BlankActivity。

  

为什么activity_main.xml文件中没有preferred的活动布局直接了

您当然欢迎使用 activity_main.xml 为任何你想要的。恰巧,谷歌目前的模板,希望你使用的片段。谷歌的模板只是模板。有人可能会说 - 我有,激烈 - 一个BlankActivity模板不应该做它在做什么。然而,除此之外,它只是一个模板。

  

为什么appcompat库现在包括在每一个项目?

presumably,他们希望以一致行动起来吧,你开始了,即使在旧的API级别。

  

我知道它是与动作条,但问题是,每当我创建一个新项目一个红色的感叹号显示了这两个项目的文件,并appcompat_v7文件放在这个$ P $的编译/运行的应用程序或pvents我甚至有时候appcompat_v7文件不创建和我得到的唯一一件事就是损坏的code

我报这个问题一个星期前。

  

让我怎么能消除这种依赖关系

步骤#1:用鼠标右键单击多年来在Package Explorer中的项目名称,然后选择属性。点击机器人在左侧属性类别列表中,并在底部右侧向下滚动:

步骤2:在连接库项目,你现在会在属性对话框中看到的列表中,您可能会看到一个条目类似的appcompat_v7_6一,你在上面的截图中看到。你最后的数字会有所不同,并且它可能是你有一个红色的X,而不是一个绿色的对勾。无论如何,如果没有在列表中的appcompat_v7_NNN条目,点击它,然后单击删除按钮,在列表的右侧。然后,单击确定按钮,关闭弹出的对话框。

第三步:在 RES /价值/ styles.xml ,从<$更改 AppBaseTheme 父C $ C> Theme.AppCompat.Light 到 @android:款式/ Theme.Light 。在 RES /值-V11 / styles.xml ,从更改 AppBaseTheme 父主题.AppCompat.Light @android:款式/ Theme.Holo.Light 。在休息/值-V14 / styles.xml 主题更改 AppBaseTheme 父。 AppCompat.Light.DarkActionBar @android:款式/ Theme.Holo.Light.DarkActionBar 。请注意,这些数值假定你选择默认的光的主题与黑暗行动起来吧,当你创建项目 - 你将需要作出轻微的调整,这些指令为别的

第四步:在 RES /菜单/主/ XML ,删除的xmlns:程序=htt​​p://schemas.android.com / APK / RES-AUTO从根&LT;菜单&gt; 元素和应用程序:showAsAction =从不 从属性&LT;项目&GT; 元素

第五步:在你的活动(例如, MainActivity ),父类的活动更改为 ActionBarActivity - FragmentActivity 将是一个不错的选择,最大限度地减少了其他变化,你将不得不立即做出数。此外,清洁你的进口(例如,按Ctrl-Shift-O组合)。

在这一点上,或许比清理你的项目(Project>从主菜单中清洁),在 appcompat 的东西应该被撕开了一个项目的其他使用创造了 BlankActivity模板和一个,的无导航类型。其它模板,或在BlankActivity模板导航选项,可能会需要更多的工作。

I've updated my eclipse and ADT Plugin to the latest version recently and recognised some big changes. Whenever I create a new Android Application Project there appears a new appcompat_v7 library which wasn't present before and also a fragment_main.xml . Why is that? Why is the activity_main.xml file not preferred for activity layout directly anymore and why appcompat library is now included in every project ? I tried to remove eclipse/adt/sdk many times and remove the support library from sdk manager but got no result ! I realize it has something to do with actionbar but the problem is that whenever I create a new project a red exclamation mark shows up on both project's file and appcompat_v7 file and this prevents me from compiling/running the application or even sometimes appcompat_v7 file doesn't create and the only thing I get is damaged code here's a picture :http://i.stack.imgur.com/XJMfW.png

so how can I remove this dependency and thanks

解决方案

Why is that?

Because Google engineers added that stuff to the new-activity templates, for at least the "BlankActivity".

Why is the activity_main.xml file not preferred for activity layout directly anymore

You are certainly welcome to use activity_main.xml for whatever you want. It so happens that Google's current templates want you to use fragments. Google's templates are just templates. One can argue -- and I have, vehemently -- that a "BlankActivity" template should not be doing what it is doing. However, beyond that, it is just a template.

why appcompat library is now included in every project ?

Presumably, they wanted to start you off with a consistent action bar, even on older API levels.

I realize it has something to do with actionbar but the problem is that whenever I create a new project a red exclamation mark shows up on both project's file and appcompat_v7 file and this prevents me from compiling/running the application or even sometimes appcompat_v7 file doesn't create and the only thing I get is damaged code

I reported this issue a week or so ago.

so how can I remove this dependency

Step #1: Right-click over the project name in the Package Explorer, and choose Properties. Click on Android in the list of property categories on the left, and scroll down on the right to the bottom:

Step #2: In the list of attached library projects that you will now see in the properties dialog, you may see an entry akin to the "appcompat_v7_6" one that you see in the above screenshot. Your last digit will differ, and it may be that yours has a red X instead of a green checkmark. Regardless, if there is an entry for "appcompat_v7_NNN" in the list, click on it, then click the Remove button to the right of the list. Then, click the OK button to close up the dialog.

Step #3: In res/values/styles.xml, change the parent of AppBaseTheme from Theme.AppCompat.Light to @android:style/Theme.Light. In res/values-v11/styles.xml, change the parent of AppBaseTheme from Theme.AppCompat.Light to @android:style/Theme.Holo.Light. In rest/values-v14/styles.xml change the parent of AppBaseTheme from Theme.AppCompat.Light.DarkActionBar to @android:style/Theme.Holo.Light.DarkActionBar. Note that these values assume that you chose the default "Light theme with dark action bar" when you created the project -- you will need to make slight adjustments to those instructions for anything else.

Step #4: In res/menu/main/xml, remove xmlns:app="http://schemas.android.com/apk/res-auto" from the root <menu> element and the app:showAsAction="never" attribute from the <item> element.

Step #5: In your activity (e.g., MainActivity), change the parent class of the activity to something other than ActionBarActivity -- FragmentActivity would be a good choice, to minimize the number of other changes you will have to make immediately. Also, clean your imports (e.g., Ctrl-Shift-O).

At this point, other than perhaps cleaning your project (Project > Clean from the main menu), the appcompat stuff should be ripped out of a project created using the "BlankActivity" template and with a "Navigation Type" of "None". Other templates, or navigation options on the "BlankActivity" template, will probably require more work.

这篇关于如何删除支持库(appcompat_v7)的Eclipse]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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