So I have often met such projects in which the structure of the project itself is divided into 2 ... 2 manifest files 2 java directories and 2 res directories ... Why do they do this? and how in this case the project is launched? I understand that the program reads the structure of the manifest? And when there are 2 of them, how then does she understand the structure of the project?

enter image description here

  • Such a structure is needed to distribute the library and application examples of its use. To use the library, you only need the library module β€” YuriSPb ♦

2 answers 2

You have a library in your project, a library module, and an example for it, a sample module. The library has a similar structure as a regular application module . Those. they have their own build/ libs/ src/ AndroidManifest.xml folders that they use in their work. They are needed to determine the source code files they need, the resources, the permissions they need, etc.

    I rummaged here and if I understood correctly, then in this case a library is added to the project in this way.

    The library is added to an existing project as a separate project and it has its own manifest and all associated resources.

    In the process of implementing it in my project, I needed to add a line to build.gradle at the module level in dependencies , this is the line

     compile project (':library') 

    , then in settings.gradle added

     include ':library', ':app' 

    and in build.gradle at the Project level Project changed its classpath to

     classpath 'com.android.tools.build:gradle:1.2.3' 

    and it all worked))