Android Studio

Android Studio est un IDE gratuit pour le développement d'Android, fait par Google et JetBrains. Il est basé sur IntelliJ IDEA et dispose d'un éditeur riche en fonctionnalités qui supporte Java et C/C++. Il peut être utilisé pour travailler sur le moteur principal de Godot ainsi que sur la base de code de la plate-forme Android.

Importation du projet

  • From the Android Studio's welcome window select Open.

../../../_images/android_studio_setup_project_1.png

Fenêtre d'accueil d'Android Studio.

  • Naviguez jusqu'au <Godot root directory>/platform/android/java et sélectionnez le fichier settings.gradle.

  • Android Studio va importer et indexer le projet.

Android Studio project layout

Le projet est organisé à l'aide des modules d'Android Studio :

  • module``lib`` :
    • Situé sous``<Godot root directory>/platform/android/java/lib``, il s'agit d'un module de bibliothèque qui organise

      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.

  • Module éditeur :
    • Situé sous``<Godot root directory>/platform/android/java/editor``, il s'agit d'un module d'application qui contient

      the source code for the Android port of the Godot Editor.

    • This module has a dependency on the lib module.

  • module``app`` :
    • Situé sous``<Godot root directory>/platform/android/java/app``, il s'agit d'un module d'application qui contient

      the source code for the Android build templates.

    • This module has a dependency on the lib module.

Building & debugging the editor module

  • Pour compiler le module editor :
    ../../../_images/android_studio_editor_configurations_drop_down.webp
  • Pour déboguer le module editor :
    • 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.

    ../../../_images/android_studio_editor_build_variant.webp
    • 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)

    ../../../_images/android_studio_editor_debug_type_setup.webp

Building & debugging the app module

The app module requires the presence of a Godot project in its assets directory (<Godot root 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:

  • Pour compiler le module app :
    ../../../_images/android_studio_app_configurations_drop_down.webp
  • Pour déboguer le module app :
    • 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.

    ../../../_images/android_studio_app_build_variant.webp
    • 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)

    ../../../_images/android_studio_app_debug_type_setup.webp

If you run into any issues, ask for help in Godot's Android dev channel.