Risposte:
Dalla documentazione (Android Studio si basa su Intellij IDEA):
Qualunque cosa tu faccia in IntelliJ IDEA, lo fai nel contesto di un progetto. Un progetto è un'unità organizzativa che rappresenta una soluzione software completa.
Il tuo prodotto finito può essere scomposto in una serie di moduli discreti e isolati, ma è una definizione di progetto che li unisce e li lega in un tutto più grande.
Per Android, significa un progetto per app e un modulo per libreria e per app di prova.
Esistono diversi problemi se si tenta di creare più app all'interno dello stesso progetto. È possibile, ma se ci provi (come ho fatto io), vedrai che quasi tutto è progettato per funzionare con un'unica app per progetto.
Ad esempio, esiste un'opzione per "ricostruire il progetto", il che non ha senso con più app, molte altre impostazioni del progetto sarebbero inutili e il sistema VCS integrato non è eccezionale quando si hanno più repository.
KISS risposta:
Il modulo in Android Studio è come un progetto in Eclipse
progetto in Android Studio è come uno spazio di lavoro in Eclipse
Un progetto in Android Studio rappresenta un'app Android completa. I progetti Android Studio sono costituiti da uno o più moduli .
Un modulo è un componente della tua app che puoi creare, testare o eseguire il debug in modo indipendente.
I moduli contengono il codice sorgente e le risorse per la tua app.
I moduli forniscono un contenitore per il codice sorgente dell'app, i file di risorse e le impostazioni a livello di app, come il file di build a livello di modulo e il file manifest Android. Ogni modulo può essere costruito, testato e sottoposto a debug in modo indipendente.
Android Studio utilizza i moduli per semplificare l'aggiunta di nuovi dispositivi al progetto. Seguendo alcuni semplici passaggi in Android Studio, puoi creare un modulo per contenere il codice specifico per un tipo di dispositivo, come Wear OS o Android TV. Android Studio crea automaticamente le directory dei moduli, come le directory di origine e delle risorse, e un file build.gradle predefinito appropriato per il tipo di dispositivo. Inoltre, Android Studio crea moduli dispositivo con le configurazioni di build consigliate, ad esempio utilizzando la libreria Leanback per i moduli TV Android.
Ex:
Oltre a questi, puoi anche avere un "modulo di libreria locale". Supponiamo che sviluppi un Account Management Framework come modulo di libreria da utilizzare in definitiva nella tua app, puoi farlo come modulo separato nello stesso progetto. Per includerlo nella tua app, dovresti scrivere qualcosa del tipo,
compile project(':mylibrary')
I documenti dicono,
Questo dichiara una dipendenza da un modulo di libreria Android chiamato "mylibrary" (questo nome deve corrispondere al nome della libreria definito come include nel file settings.gradle). Richiede che il sistema di compilazione compili il modulo della libreria con il modulo dell'app e includa il file AAR risultante nel proprio APK.
Infine, Intellij menziona alcuni dettagli in più sui file di configurazione del modulo:
Le informazioni di configurazione per un modulo sono memorizzate in un file di modulo .iml . Per impostazione predefinita, tale file si trova nella cartella principale del contenuto del modulo.
I team di sviluppo, normalmente, condividono i
.iml
file del modulo attraverso il controllo della versione.
Questo .iml
file è un po ' spaventoso da guardare. Ecco un esempio dal mio progetto:
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="LearnCity" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res/layouts/common/layout/ver3/layout" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver3/layout;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver3;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver2/layout;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver2;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver1/layout;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver1;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver0/layout;file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver0;file://$MODULE_DIR$/src/main/res/layouts/common/layout;file://$MODULE_DIR$/src/main/res/layouts/learner/layout;file://$MODULE_DIR$/src/main/res/layouts/tutor/layout;file://$MODULE_DIR$/src/main/res/layouts/obsolete/layout;file://$MODULE_DIR$/src/main/res/layouts/common;file://$MODULE_DIR$/src/main/res/layouts/learner;file://$MODULE_DIR$/src/main/res/layouts/tutor;file://$MODULE_DIR$/src/main/res/layouts/obsolete;file://$MODULE_DIR$/src/main/res/layouts;file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/google-services/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver3/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver3" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver2/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver2" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver1/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver1" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver0/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout/ver0" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/learner/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/tutor/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/obsolete/layout" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/common" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/learner" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/tutor" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts/obsolete" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res/layouts" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/multi-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="google-http-client-android-1.22.0" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-10.2.0" level="project" />
<orderEntry type="library" exported="" name="firebase-core-10.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-base-10.2.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.8.0" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-10.2.0" level="project" />
<orderEntry type="library" exported="" name="constraint-layout-1.0.2" level="project" />
<orderEntry type="library" exported="" name="appengine-api-1.0-sdk-1.9.50" level="project" />
<orderEntry type="library" exported="" name="design-25.3.0" level="project" />
<orderEntry type="library" exported="" name="android-job-1.1.8" level="project" />
<orderEntry type="library" exported="" name="transition-25.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-10.2.0" level="project" />
<orderEntry type="library" exported="" name="multispinner-0.1.1" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-10.2.0" level="project" />
<orderEntry type="library" exported="" name="support-core-ui-25.3.0" level="project" />
<orderEntry type="library" exported="" name="simpleratingbar-0.1.5" level="project" />
<orderEntry type="library" exported="" name="play-services-maps-10.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-location-10.2.0" level="project" />
<orderEntry type="library" exported="" name="firebase-iid-10.2.0" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-25.3.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-2.0.1" level="project" />
<orderEntry type="library" exported="" name="support-fragment-25.3.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="multidex-instrumentation-1.0.1" level="project" />
<orderEntry type="library" exported="" name="constraint-layout-solver-1.0.2" level="project" />
<orderEntry type="library" exported="" name="androidannotations-api-3.2" level="project" />
<orderEntry type="library" exported="" name="java-uuid-generator-3.1.4" level="project" />
<orderEntry type="library" exported="" name="google-http-client-1.22.0" level="project" />
<orderEntry type="library" exported="" name="firebase-messaging-10.2.0" level="project" />
<orderEntry type="library" exported="" name="firebase-analytics-impl-10.2.0" level="project" />
<orderEntry type="library" exported="" name="firebase-common-10.2.0" level="project" />
<orderEntry type="library" exported="" name="eventbus-3.0.0" level="project" />
<orderEntry type="library" exported="" name="cat-1.0.5" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-10.2.0" level="project" />
<orderEntry type="library" exported="" name="support-compat-25.3.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-25.3.0" level="project" />
<orderEntry type="library" exported="" name="multidex-1.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="support-media-compat-25.3.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-25.3.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-25.3.0" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-25.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-25.3.0" level="project" />
<orderEntry type="library" exported="" name="support-vector-drawable-25.3.0" level="project" />
<orderEntry type="module" module-name="backend" exported="" />
<orderEntry type="library" exported="" name="android-android-25" level="project" />
</component>
</module>
@Deprecated
?). Questo ha molto più senso.
IntelliJ IDEA crea un progetto per l'intera base di codice con cui si lavora e un modulo per ciascuno dei suoi singoli componenti. Quindi, il modulo IntelliJ IDEA è più simile a un progetto Eclipse e il progetto è approssimativamente simile allo spazio di lavoro Eclipse. Non esiste un equivalente esatto dell'area di lavoro di Eclipse che contiene tutto il tuo lavoro, ma puoi aprire più progetti in più frame contemporaneamente.
Ecco la pagina di domande e risposte di IntelliJ IDEA per gli utenti di Eclipse-
http://www.jetbrains.com/idea/documentation/migration_faq.html
Facendo riferimento alla risposta di @Oded Breiner direi che:
Il modulo in Android Studio è come un progetto in Eclipse
progetto in Android Studio è come un set di lavoro in Eclipse