昨天在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. Unity -- 入门教程三

    进入这个页面,按编译器版本进行下载,我用的是2010,所以要下载这个. 安装就不用我教了,下面开始看我是如何导入Unity VS的. 点击Import之后我们会发现并没有发生什么,但是接下来我们按一下 ...

  2. linux的history命令设置

    history的历史记录,同一个用户的各个会话,读取到的内容也是不一样的,原因是它读取的是shell会话缓存里的内容.只有当用户退出当前会话的时候,会话里的缓存内容才会写入~/.bash_histor ...

  3. talkingdata比赛分析

    1.kaggle数据分析经验: https://medium.com/unstructured/how-feature-engineering-can-help-you-do-well-in-a-ka ...

  4. 在pypy环境中运行odoo8

    PyPy是一个独立的解析器, 通过即时编译(JIT,Just-in-time)代码避免逐行解释执行来提升运行速度的(将编译过的行代码缓存起来,从而加快速度).我们一般使用的Python一般是使用C实现 ...

  5. C++静态库与动态库深入研究

    什么是库 库是写好的现有的,成熟的,可以复用的代码.现实中每个程序都要依赖很多基础的底层库,不可能每个人的代码都从零开始,因此库的存在意义非同寻常. 本质上来说库是一种可执行代码的二进制形式,可以被操 ...

  6. ListView 自己定义BaseAdapter实现单选打勾(无漏洞)

    (假设须要完整demo,请评论留下邮箱) (眼下源代码已经不发送.假设须要源代码,加qq316701116.不喜勿扰) 近期由于一个项目的原因须要自己定义一个BaseAdapter实现ListVIew ...

  7. MySQL中文显示乱码

    http://blog.csdn.net/acmain_chm/article/details/4174186 

  8. iOS_12_tableViewCell的删除更新_红楼梦

    终于效果图: Girl.h // // Girl.h // 12_tableView的增删改 // // Created by beyond on 14-7-27. // Copyright (c) ...

  9. centos7下MySQL的配置

    1. 下载mysql的repo源 wget http:.noarch.rpm 2. 安装mysql-community-release-el7-5.noarch.rpm包 rpm .noarch.rp ...

  10. hdu1028(母函数+DP)

    题目信息:求分解整数n的个数q(n);能够母函数或者DP http://acm.hdu.edu.cn/showproblem.php?pid=1028 AC代码: /***************** ...