Now that we have an Android project A, we want to expand the functionality of a, but do not want to build on the basis of a, and then create another Android project B to reference A in B. There are usually two ways to achieve this:
1, make the project a pure jar package
Right-click Project-->export--> tap java--->jar file--->Next--> tick src package, other items do not select-click Finish to generate the JAR file.
However, if a reference in R.java is used in project A, it cannot be hit as a jar package. The reason is that R.java is generated automatically and is dynamic, and each compilation is not the same. If you must make a jar package, you can not use the auto-generated R file, use the resources to write code to get.
2. Make project A into Android library project
Set up project A, right-->properties->android, select the IS library item, and apply. Set Project B, right-->properties->android, in the library, click the Add button to add a project, and then apply. The resources and code in A are introduced in B at this point, and these resources and code can be called directly. It is important to note that because a is no longer a complete Android application, it is a class library project, so there are some things that need to be configured in B. For example, a in the Lib library reference, B will also be added to the Lib library, such as the contents of the Androidmanifest.xml file in a, in the B androidmanifest.xml file should also be added ...
If you do not need to reference a project's resource files, you just have to get the jar file, set up project A, right-click->properties->android, select the IS library item, and apply. A jar file can be obtained from the bin directory of the A project, which is directly referenced in the Libs directory in Project B.
Reference from: http://blog.csdn.net/lixin88/article/details/8609575
(71) One project in Android referencing another project