Now we have an Android Project. We want to expand the function of A, but do not want to develop on the basis of A, So we created another Android Project B and wanted to reference A in B.
One idea is to make project A pure Jar package so that other projects can be referenced directly.
However, if the reference in R. java is used in project A, it cannot be packaged into A jar package. The reason is that R. java is automatically generated and dynamic, and each compilation is different. If you must make a jar package, you cannot use the automatically generated R file. When using resources, you need to write code to get it.
Another idea is to make project A an android library project.
Set Project A, right-click and choose Properties> Android, select the Is library item, and then Apply. Set Project B, right-click and choose Properties> Android. In the Library, click Add to Add Project A, and then Apply. In this case, resources and code in A are introduced in B, which can be called directly. It should be noted that, because A is no longer A complete Android Application, but A class library project, some content needs to be configured in B. For example, if A has A lib library reference, B must also add the lib library. For example, the AndroidManifest. xml file in A must be added to the AndroidManifest. xml file in B...