问题描述:

使用eclipse创建一个Android项目时,发现project列表中会多创建出一个appcompat_v7项目,再创建一个Android项目时,又会再多出一个appcompat_v7_2,如果再次创建,会以此类推地创建出appcompat_v7_x格式的“多余项目”出来(此情况在ADT升级为22.6.x版本后出现,22.3.x前的版本不会有)

查明原因:

ADT在22.3.x版本前没有出现该情况,升级为22.6.x版本后,才出现该情况,可以猜测是新版本导致。猜测到原因后可以分析下appcompat_v7是用来做什么的,展开appcompat_v7项目,会发现有一个readme.txt文件,双击查看,该文件描述如下:

Library Project including compatibility ActionBar.

This can be used by an Android project to provide
access to ActionBar on applications running on API 7+.

There is technically no source, but the src folder is necessary
to ensure that the build system works.  The content is actually
located in libs/android-support-v7-appcompat.jar.
The accompanying resources must also be included in the application.

字面意思大概可以看出,该项目是一个Library Project, 作用是让你的Android Project 在API 7+的sdk版本(即Android2.1版本)可以访问ActionBar的API,ActionBar相当于用户界面的操作栏,具体ActionBar的解释可以参考:http://developer.android.com/guide/topics/ui/actionbar.html。所以从中可以看出多出这个project是为了兼容低版本的sdk,那我们创建的Android项目是如何引用这个类库项目呢?通过右键点击Android项目---->Properties-->Android,可以查看到该类库项目已被引用进来了

原因已查明,可以验证一下:

首先创建一个Android项目,在选择Android版本号的界面,如果选择的最低Android版本的"大版本号”小于编译时采用的Android大版本号时,就需要考虑版本兼容问题,这样子创建出项目后自然就会产生出appcompat_v7这个类库项目出来。具体界面如下图,如果编译时采用4.3版本,选择最低要求版本号为2.x或者3.x时创建出来的项目就会自动创建appcompat_v7支持库。

疑问:

可以不产生appcompat_v7这个类库项目吗?答案是可以的,只要版本号选择时最低要求版本和编译时用的版本选择同一种即可,但不推荐这么干,开发Android程序需要考虑兼容多个版本

补充:

关于Library Project的相关内容,可以通过查看官方文档介绍,具体查看:http://developer.android.com/tools/support-library/features.html#v4

找到 v7 appcompat library 的解释:内容如下:

This library adds support for the Action Bar user interface design pattern.

Note: This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part of this library's classpath.

Here are a few of the key classes included in the v7 appcompat library:

  • ActionBar - Provides an implementation of the action bar user interface pattern. For more information on using the Action Bar, see the Action Bar developer guide.
  • ActionBarActivity - Adds an application activity class that must be used as a base class for activities that uses the Support Library action bar implementation.
  • ShareActionProvider - Adds support for a standardized sharing action (such as email or posting to social applications) that can be included in an action bar.

This library is located in the <sdk>/extras/android/support/v7/appcompat/ directory after you download the Android Support Libraries. This library contains user interface resources. To include it in your application project, follow the instructions for adding libraries with resources.

The Gradle build script dependency identifier for this library is as follows:

以上是个人解决问题过程中查阅一些资料得出的一些结论,可能会有不对的地方,希望有看出问题的仁兄指点一二。刚开始学习Android开发,有些知识实现太薄弱,为了记录下平时遇到的一些问题,也只好先将自己理解的一些东西写出来,等对Android多熟悉一些,再回来检查下这些文章吧<( ̄︶ ̄)>

关于Eclipse创建Android项目时,会多出一个appcompat_v7的问题相关推荐

  1. 【转】关于Eclipse创建Android项目时,会多出一个appcompat_v7的问题

    问题描述: 使用eclipse创建一个Android项目时,发现project列表中会多创建出一个appcompat_v7项目,再创建一个Android项目时,又会再多出一个appcompat_v7_ ...

  2. 使用eclipse创建javaweb项目时在jsp页面出现的404servlet找不到的问题

    新手小白的第一篇文章--使用eclipse创建javaweb项目时在jsp页面出现的404servlet找不到的问题 小白在做期末项目的时候出现了404servlet找不到的问题 一开始出现的问题的时 ...

  3. Eclipse创建Java项目时提示Open Associated Perspective?

    问题: 在Eclipse中创建 java project 时,弹出了一个提示框,如下: 把弹窗中的英文翻译成中文 消息框内翻译如下: Open Associated Perspective? –开放关 ...

  4. eclipse新建Android项目时提示AndroidManifest.xml file missing!

    最近在家做一个小的项目时发现刚新建了一个项目还没2秒钟控制台就输出AndroidManifest.xml file missing! 是么R文件统统没有.原来是项目名称不能带中文,用英文的就OK了.

  5. eclipse创建maven项目时出现Could not calculate build plan 错误解决方法

    一.问题描述 在eclipse里面创建maven时候出现了Could not calculate build plan错误,通过网上查询最终找到的解决方法. 二.问题原因 应该是maven本地仓库中缺 ...

  6. eclipse运行android项目出现The connection to adb is down, and a severe error has occured.的问题

    问题描述:在eclipse运行android项目时出现以下信息: [plain] view plaincopy The connection to adb is down, and a severe ...

  7. 创建Maven项目时实际使用JDK为1.8,该怎样修改其默认的JDK1.5

    场景 eclipse创建maven项目时,显示的JDK默认版本为1.5,实际使用的JDK为1.8,如何修改? 实现 找到本机maven存放位置. 默认是${user.home}/.m2/路径 如果已经 ...

  8. Eclipse使用Maven插件创建Web项目时出错:Could not resolve archetype org.apache.maven.archetypes

    问题描述: 在Eclipse下,使用Maven插件创建Web项目时出错,错误提示如下: 错误信息: Could not resolve archetype org.apache.maven.arche ...

  9. Eclipse导入android项目出现很多错误

    Eclipse导入android项目出现很多错误 [问题描述]       使用Eclipse导入别人正确的android项目,会出现很多未知的错误.如下面的AndroidTest项目,在别人的Ecl ...

最新文章

  1. 前OnePlus视觉设计师蔡孝永:视觉设计师都在想些什么?
  2. 查看linux字符集命令,关于Linux字符集的查看及修改
  3. C#静态类 转载:(原文:http://www.cnblogs.com/chenlulouis/ )
  4. ElasticSearch踩坑记录
  5. SAP Spartacus login 页面看不到 UI 控件的问题解决
  6. 上大学后男生的两种变化
  7. 阿米洛键盘取消win_阿米洛花旦娘静电容V2键盘测评:不止是一把好看的键盘
  8. java并查集找朋友圈_图—并查集(解决朋友圈问题)
  9. jvm 安装位置_简单了解JVM
  10. 构建高并发高可用的电商平台架构实践 转载
  11. JS小游戏-极速快跑
  12. android base64 字符串,Android 文件转base64字符串
  13. Unity3D 脚本实现动画效果
  14. 计算机基础与c语言程序设计题库,2017年计算机基础考试题库完整版「附答案解析」...
  15. 计算机图形图像处理应用教程,计算机图形图像处理——Photoshop实用教程
  16. 即时通讯工具腾讯 QQ v9.1.9.26361 绿色便携版
  17. modelsim vopt
  18. 【Java】教学视频资源
  19. keep行走和计步_KEEP跑步计步器
  20. 前后坐人书柜书桌的标准做法

热门文章

  1. JavaScript实现判断整数是否为2的幂isPowerOfTwo算法(附完整源码)
  2. wxWidgets:类型Types 示例
  3. boost::intrusive::sg_set用法的测试程序
  4. boost::iterator_archetypes用法的测试程序
  5. boost::fusion::cons用法的测试程序
  6. boost::coroutine2模块实现layout的测试程序
  7. ITK:在不复制内存的情况下为每个像素添加常量
  8. ITK:创建一个后向差分运算符
  9. VTK:隐式函数之ImplicitSphere
  10. OpenCV方向梯度直方图HOG的实例(附完整代码)