diff --git a/contributing/development/configuring_an_ide/android_studio.rst b/contributing/development/configuring_an_ide/android_studio.rst index 511f128ff..225052473 100644 --- a/contributing/development/configuring_an_ide/android_studio.rst +++ b/contributing/development/configuring_an_ide/android_studio.rst @@ -22,7 +22,88 @@ Importing the project - Navigate to ``/platform/android/java`` and select the ``settings.gradle`` file. - Android Studio will import and index the project. -- To build the project, follow the :ref:`compiling instructions `. -If you run into any issues, ask for help in one of -`Godot's community channels `__. +Android Studio project layout +----------------------------- + +The project is organized using `Android Studio's modules `_: + +- ``lib`` module: + - Located under ``/platform/android/java/lib``, this is a **library module** that organizes + the Godot java and native code and make it available as a reusable dependency / artifact. + - The artifact generated by this module is made available for other Android modules / projects to use as a dependency, via `MavenCentral `_. + +- ``editor`` module: + - Located under ``/platform/android/java/editor``, this is an **application module** that holds + the source code for the Android port of the Godot Editor. + - This module has a dependency on the ``lib`` module. + +- ``app`` module: + - Located under ``/platform/android/java/app``, this is an **application module** that holds + the source code for the Android build templates. + - This module has a dependency on the ``lib`` module. + +Building & debugging the editor module +-------------------------------------- + +- To build the ``editor`` module: + - Select the `Run/Debug Configurations drop down `_ and select ``editor``. + + .. figure:: img/android_studio_editor_configurations_drop_down.webp + :figclass: figure-w480 + :align: center + + - Select **Run > Run 'editor'** from the top menu or `click the Run icon `_. +- To debug the ``editor`` module: + - Open the **Build Variants** window using **View > Tools Windows > Build Variants** from the top menu. + - In the **Build Variants** window, make sure that in the **Active Build Variant** column, the ``:editor`` entry is set to **dev**. + + .. figure:: img/android_studio_editor_build_variant.webp + :figclass: figure-w480 + :align: center + + - Open the **Run/Debug Configurations** window by clicking on **Run > Edit Configurations...** on the top menu. + - In the **Run/Debug Configurations** window, select the ``editor`` entry, and under **Debugger** make sure the **Debug Type** is set to ``Dual (Java + Native)`` + + .. figure:: img/android_studio_editor_debug_type_setup.webp + :figclass: figure-w480 + :align: center + + - Select **Run > Debug 'editor'** from the top menu or `click the Debug icon `_. + +Building & debugging the app module +----------------------------------- + +The ``app`` module requires the presence of a Godot project in its ``assets`` directory (``/platform/android/java/app/assets``) to run. +This is usually handled by the Godot Editor during the export process. +While developing in Android Studio, it's necessary to manually add a Godot project under that directory to replicate the export process. +Once that's done, you can follow the instructions below to run/debug the ``app`` module: + +- To build the ``app`` module: + - Select the `Run/Debug Configurations drop down `_ and select ``app``. + + .. figure:: img/android_studio_app_configurations_drop_down.webp + :figclass: figure-w480 + :align: center + + - Select **Run > Run 'app'** from the top menu or `click the Run icon `_. +- To debug the ``app`` module: + - Open the **Build Variants** window using **View > Tools Windows > Build Variants** from the top menu. + - In the **Build Variants** window, make sure that in the **Active Build Variant** column, the ``:app`` entry is set to **dev**. + + .. figure:: img/android_studio_app_build_variant.webp + :figclass: figure-w480 + :align: center + + - Open the **Run/Debug Configurations** window by clicking on **Run > Edit Configurations...** on the top menu. + - In the **Run/Debug Configurations** window, select the ``app`` entry, and under **Debugger** make sure the **Debug Type** is set to ``Dual (Java + Native)`` + + .. figure:: img/android_studio_app_debug_type_setup.webp + :figclass: figure-w480 + :align: center + + - Select **Run > Debug 'app'** from the top menu or `click the Debug icon `_. + + +If you run into any issues, ask for help in +`Godot's Android dev channel `__. diff --git a/contributing/development/configuring_an_ide/img/android_studio_app_build_variant.webp b/contributing/development/configuring_an_ide/img/android_studio_app_build_variant.webp new file mode 100644 index 000000000..88c56cfcc Binary files /dev/null and b/contributing/development/configuring_an_ide/img/android_studio_app_build_variant.webp differ diff --git a/contributing/development/configuring_an_ide/img/android_studio_app_configurations_drop_down.webp b/contributing/development/configuring_an_ide/img/android_studio_app_configurations_drop_down.webp new file mode 100644 index 000000000..89273d413 Binary files /dev/null and b/contributing/development/configuring_an_ide/img/android_studio_app_configurations_drop_down.webp differ diff --git a/contributing/development/configuring_an_ide/img/android_studio_app_debug_type_setup.webp b/contributing/development/configuring_an_ide/img/android_studio_app_debug_type_setup.webp new file mode 100644 index 000000000..b606415d4 Binary files /dev/null and b/contributing/development/configuring_an_ide/img/android_studio_app_debug_type_setup.webp differ diff --git a/contributing/development/configuring_an_ide/img/android_studio_editor_build_variant.webp b/contributing/development/configuring_an_ide/img/android_studio_editor_build_variant.webp new file mode 100644 index 000000000..a5585dcc2 Binary files /dev/null and b/contributing/development/configuring_an_ide/img/android_studio_editor_build_variant.webp differ diff --git a/contributing/development/configuring_an_ide/img/android_studio_editor_configurations_drop_down.webp b/contributing/development/configuring_an_ide/img/android_studio_editor_configurations_drop_down.webp new file mode 100644 index 000000000..3d5b5919d Binary files /dev/null and b/contributing/development/configuring_an_ide/img/android_studio_editor_configurations_drop_down.webp differ diff --git a/contributing/development/configuring_an_ide/img/android_studio_editor_debug_type_setup.webp b/contributing/development/configuring_an_ide/img/android_studio_editor_debug_type_setup.webp new file mode 100644 index 000000000..92b96517a Binary files /dev/null and b/contributing/development/configuring_an_ide/img/android_studio_editor_debug_type_setup.webp differ