昨天在ADT Manager里更新了一些组件,结果ADT不支持。索性直接下载了最新的ADT。但是发现无论创建什么类型的应用(无论支持的最低API是多少,或者是不是用模板),都会在创建应用的同时创建一个appcompat_v7的类库,然后用创建的应用引用它。

这个类库是用来向以前基本兼容的,比如让3.0之前的版本支持ActionBar。但Google为什么每次都要引用这个呢,令人费解,现在2.x的份额已经降到很低了。难道是为了推广自家的appcompat类库,让用户摆脱ActionBarSherlock吗。

在StackOverflow上看到有人问同样的问题,有人给出了回答(戳这里),这里整理一下:

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。

步骤一:右击项目,选择Properties,选择左侧的Android。

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.

步骤二:在Library窗口,选中 "appcompat_v7_NNN",选择Remove,然后点OK。

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.、

步骤三:res/values/styles.xml中,把AppBaseTheme的parent从Theme.AppCompat.Light 改成 @android:style/Theme.Light。

    res/values-v11/styles.xml中, change the parent of AppBaseTheme from Theme.AppCompat.Light to @android:style/Theme.Holo.Light.

    rest/values-v14/styles.xml change the parent of AppBaseTheme from Theme.AppCompat.Light.DarkActionBar to @android:style/Theme.Holo.Light.DarkActionBar.

(把各个版本的style都从AppCompat改成系统默认的Theme,但是这样3.0之前的版本就不支持ActionBar了。)

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.

步骤四:删掉res/menu/main/xml中的xmlns:app="http://schemas.android.com/apk/res-auto"和app:showAsAction="never"元素。

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).

步骤五:在activity中,比如MainActivity,把继承的ActionBarActivity改成其他的东西——比如FragmentActivity,然后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.

这个时候除了Project>clean,appcompat应该差不多从你的项目里移除了。

最新版ADT(Build: v22.6.2)总是引用appcompat_v7的问题的更多相关文章

  1. 关于新版ADT创建项目时出现appcompat_v7的问题

    做Android开发的朋友最近会发现,更新ADT至22.6.0版本之后,创建新的安装项目,会出现appcompat_v7的内容.并且是创建一个新的内容就会出现.这到底是怎么回事呢?原来appcompa ...

  2. 新版ADT出现appcompat_v7的问题

    问题 更新ADT至22.6.0版本号之后,创建新的安装项目,会出现appcompat_v7的内容.而且是创建一个新的内容就会出现. 事实上appcompat_v7是Google自己的一个兼容包.一个支 ...

  3. win10环境下jdk1.8+Android Developer Tools Build: v22.3.0-887826的问题

    最进换了新电脑,配置开发环境,最新的android studio 要求jdk1.8,所以想都没想就下载1.8. 之后为了一个原来的老项目,得使用adt,遂装之,遇到一下问题 1.ADT新建项目src下 ...

  4. 新版ADT创建项目时出现appcompat_v7的问题

    做Android开发的朋友最近会发现,更新ADT至22.6.0版本之后,创建新的安装项目,会出现appcompat_v7的内容.并且是创建一个新的内容就会出现.这到底是怎么回事呢?原来appcompa ...

  5. Android adt v22.6.2 自动创建 appcompat_v7 解决方法,最低版本2.2也不会出现

    Android 开发工具升级到22.6.2在创建工程时只要选择的最低版本低于4.0,就会自动生成一个项目appcompat_v7,没创建一个新的项目都会自动创建,很是烦恼... 之前在网上也找过方法, ...

  6. 使用 ng build 构建后资源地址引用错误的问题

    最近使用 Angular 做项目的时候,通过 ng build 打包后的资源地址都带有 localhost:4200,百思不得其解,以为是打包的问题. 最后在 index.html 的文件中发现有一个 ...

  7. Windows环境下教你用Eclipse ADT 插件生成.h/.so文件,Java下调用JNI,轻松学习JNI

    准备工作:Eclipse ADT IDE 开发工具,NDK .Java 环境,博主的配置是:Windows x86 , ADT Build: v22.3.0-887826 , JAVA 1.7, ND ...

  8. Android海康监控视频调用demo

    一. 开发环境 1. 操作系统:windows7(X64) 2. 开发工具:eclipse adt Build: v22.2.1-833290 JDK7 android SDK 3. 客户端设备版本: ...

  9. Android Studio vs. Eclipse ADT Comparison

    Android Studio 是一个新的基于 IntelliJ IDEA Android 的安卓开发环境,它对 Eclipse ADT 进行了改进并新增了功能. Feature Android Stu ...

随机推荐

  1. DAO 层实现

    一.实验介绍 1.1 实验内容 本节课程主要利用 MyBatis 框架实现 DAO 层. 1.2 实验知识点 MyBatis 框架 MySQL 1.3 实验环境 JDK1.8 Eclipse Java ...

  2. sdut 面向对象程序设计上机练习九(对象指针)

    面向对象程序设计上机练习九(对象指针) Time Limit: 1000MS Memory limit: 65536K 题目描写叙述 建立对象数组,内放5个学生数据(学号是字符串类型.成绩是整型).设 ...

  3. JMeter 压力測试使用函数和 CSV 文件參数化 json 数据

            在 http Load Testing 中.json 数据的提交是个让人头疼的问题.本文具体介绍怎样进行 JMeter 的 json 測试提交,以及怎样将其參数化.        St ...

  4. 怎样使用Entityframework.Extended

    这个插件真的非常有用,我们能够使用下面语法来简化我们的工作,下面不过演示样例: Deleting <strong>//delete all users where FirstName ma ...

  5. 无法获取html元素宽高度的问题

    今天遇到了xxx.style.width无法获取元素宽度的问题,原来一直没有注意到这个小细节: 1)如果width:120px:是写在样式表里面的,获取宽度或者高度的方法是: xxx.offsetWi ...

  6. mysql手动停止无响应查询方法

    http://www.chenweionline.cn/archives/61.htm

  7. 搭建spark中需要注意的问题

    在搭建spark的过程中遇到了许多的问题,但是引起这些问题的原因都是因为环境变量没有设置好导致的,这里总结的一些优秀的博文,可以供以后参考 http://www.powerxing.com/insta ...

  8. Android pull to Refresh 导入出错?

    今天在导入 PuultoResfresh 的时候老是出错. error: [2014-09-28 10:04:44 - library] Unable to resolve target 'andro ...

  9. Django-admin导出到表格

    class AdminReport(admin.ModelAdmin): actions = ["saveexecl"] # 自定义的action(导出到excel表格) list ...

  10. 简述C++中的多态机制

    前言 封装性,继承性,多态性是面向对象语言的三大特性.其中封装,继承好理解,而多态的概念让许多初学者感到困惑.本文将讲述C++中多态的概念以及多态的实现机制. 什么是多态? 多态就是多种形态,就是许多 ...