官方文档:http://developer.android.com/tools/projects/index.html

1:android project

2:Test project

3:library project

库工程主要向主工程提供源码文件和资源。编译时,会将库工程的源码文件(包括R文件)和资源(图片,布局等资源)合并到主工程中。注意:不会合并manifest文件,而且库工程的manifest文件也没用,它里面的内容必须移植到主工程的manifest文件当中。当库文件中的资源ID和主工程中的资源ID相同时,主工程的资源ID将会覆盖掉库工程的资源ID。当主工程所引用的两个库工程中有相同的ID时,android编译工具会选择一个优先级高的ID 进行合并到主工程,而抛弃另一个工程的ID。

注意点:

.资源文件冲突,可以使用在资源文件名前加前缀的方式避免冲突。目前库文件不能导成jar包(以后会有工具实现的),

  • A library project can include a JAR library

    You can develop a library project that itself includes a JAR library, however you need to manually edit the dependent application project's build path and add a path to the JAR file。库工程自身仍然可以 include 一个(或多个) JAR 库文件,但是在Build Path中得打上勾,这样才会一起编译进去。主工程引用的jar包跟库工程引用的jar包是独立分开的。如果是同一个jar包,需要引用相同版本,这样才不会冲突.

  • A library project can depend on an external JAR library

    You can develop a library project that depends on an external library (for example, the Maps external library). In this case, the dependent application must build against a target that includes the external library (for example, the Google APIs Add-On). Note also that both the library project and the dependent application must declare the external library in their manifest files, in a<uses-library>element.

  • 库工程不能使用assets文件,如果一定要使用,这资源必须放在主工程的assets文件夹中。
  • 库工程使用的android版本不能高于调用它的主工程所使用的anroid版本.
  • 库工程的包名,不必改变,主工程的包名,才是生成的 apk 的包名,跟库工程没关系。

更多相关文章

  1. Android资源文件使用经验
  2. android资源汇总(持续中......)
  3. Android实践 -- Android文件储存系统 应用篇
  4. Android添加资源文件编译,R文件未重新生成解决办法
  5. 1.4.2 Android Studio工程目录结构分析

随机推荐

  1. 创建动态MSSQL数据库表
  2. SQL Server 版本变更检查 警告
  3. SQL 实用语句
  4. SQLServer 数据库中如何保持数据一致性
  5. MsSql 存储过程分页代码 [收集多篇]
  6. SqlServer 序号列的实现方法
  7. 丢失的数据忘记备份的处理方法[图文]第1/
  8. SQL SERVER 自增列
  9. sql 多表连接查询
  10. sqlserver 系统存储过程 中文说明