Modules vs Android Studio

I am very new to Android Studio and Java.

I am developing an application. This application will mainly follow a multi-level architecture with different levels, for example, user interface, data access level, service level, etc.

I do not understand the differences between packages and modules.

My question is, where could all these different layers be placed, in modules or packages?

Pointing to @Angel's answer to this question, the only difference between the two is: \, the modules define a more stringent rule that can be accessed by having import namespaces for the modules.

+4
source share
1

A module . , .

, Android Studio app. , .

Phone/Tablet, Android Wear, ; mobile wear. , .

; .

A package - , , (), . , ; com.example.app. , ; com.example.app.ui com.example.app.data.


, , src/main/java . pacakge "" .

:

project
|-- build.gradle
|-- settings.gradle
~
|-- common // a common library module for both mobile and wear
|   |-- build.gradle
|   |-- proguard-rules.pro
|   +-- src
|       +-- main
|           |-- AndroidManifest.xml
|           |-- assets
|           |-- java
|           |   +-- com
|           |       +-- example
|           |           +-- library // common module library package
|           |               |-- data
|           |               +-- util
|           +-- res
|
|-- mobile // mobile application module
|   |-- build.gradle
|   |-- proguard-rules.pro
|   +-- src
|       +-- main
|           |-- AndroidManifest.xml
|           |-- assets
|           |-- java
|           |   +-- com
|           |       +-- example
|           |           +-- app // mobile module application package
|           |               |-- data
|           |               |-- ui
|           |               +-- util
|           +-- res
|
+-- wear // wear application module
    |-- build.gradle
    |-- proguard-rules.pro
    +-- src
        +-- main
            |-- AndroidManifest.xml
            |-- assets
            |-- java
            |   +-- com
            |       +-- example
            |           +-- app // wear module application package
            |               |-- data
            |               |-- ui
            |               +-- util
            +-- res
+10

Source: https://habr.com/ru/post/1660524/


All Articles