昨天在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. 记一次痛苦的ubuntu配置Go环境 -- Ubuntu & Go

    下载Go一定到: https://golang.org/dl/  这里, 其他的都不好使. 还有go不一定跟32位和64有关, 还和CPU架构有关, 不知道架构一个一个试, 亦可以看我的关于查看Ubu ...

  2. 全面解读java虚拟机(面试考点大全)d

    学习java以来,jvm的原理已经看过好多遍了,可是很多知识点都串不起来. 今天我把jvm相关知识整理了一下,看完之后肯定会对JVM很的清楚. JVM是虚拟机,也是一种规范,他遵循着冯·诺依曼体系结构 ...

  3. Android 组件之Service解析

    原创文章,转载请注明 http://blog.csdn.net/leejizhou/article/details/50866875 李济洲的博客 Service是Android四大组件之中的一个.S ...

  4. HDU 4635 Strongly connected(强连通)经典

    Strongly connected Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  5. Odoo10尝鲜:MRP 10 新概念

    OEE [ overall equipment Effectiveness 整体设备效率 ] 整體設備效率是整合稼働率 (Availability).產能效率 (Performance).良率 (Qu ...

  6. binary-tree-maximum-path-sum——二叉树任意一条路径上的最大值

    Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. ...

  7. asp .net 为图片添加图片水印 .

    首先写好一个写入图片水印的类,先创建一个ImageWriter类库   (该类中有包含枚举类型和方法) using System; using System.Collections.Generic; ...

  8. LNMPA遇到504 Gateway time-out错误的解决方法

    Nginx的特点是处理静态很给力,Apache的特点是处理动态很稳定,两者结合起来便是LNMPA,nginx处理前端,apache处理后端,这样处理静态会很快,处理动态会很稳定. 当我以为安装完成以后 ...

  9. dubbo 实战1

    准备:先安装zookeeper,然后进入一下步骤 服务端 1.新建 maven项目 2.pom.xml 内容如下 <?xml version="1.0" encoding=& ...

  10. eclipse的debug使用(转载)

    出处:http://www.blogjava.net/yxhxj2006/archive/2012/08/30/386621.html 远程Debug: http://blog.sina.com.cn ...