android 几种Project

来源:互联网 发布:手表淘宝网 编辑:程序博客网 时间:2024/04/29 21:53

官方文档: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 的包名,跟库工程没关系。
0 0
原创粉丝点击