Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Android Studio

Android Studio è un IDE gratuito per lo sviluppo su Android creato da Google e JetBrains. È basato su IntelliJ IDEA e dispone di un editor ricco di funzionalità che supporta Java e C/C++. Si può utilizzare per lavorare sia sul motore principale di Godot, sia sul codice base della piattaforma Android.

Importare il progetto

  • Dalla finestra di benvenuto di Android Studio seleziona Open.

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

Finestra di benvenuto di Android Studio.

  • Navigare a <cartella radice di Godot>/platform/android/java e selezionare il file settings.gradle.

  • Android Studio importerà e indicizzerà il progetto.

Disposizione del progetto in Android Studio

Il progetto è organizzato attraverso i moduli di Android Studio:

  • lib module:

    • Located under <Godot root directory>/platform/android/java/lib, this is a library module that organizes the Godot java and native code and make it available as a reusable Android library.

    • The generated Godot Android library is made available for other Android modules / projects via MavenCentral, along with its documentation.

  • editor module:

    • Located under <Godot root directory>/platform/android/java/editor, this is an application module that holds the source code for the Android and XR ports of the Godot Editor.

    • This module has a dependency on the lib module.

  • app module:

    • Located under <Godot root directory>/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.

Compilazione e debug del modulo editor

  • Per compilare il modulo editor:

    ../../../_images/android_studio_editor_configurations_drop_down.webp
  • Per effettuare il debug del modulo editor:

    • Aprire la finestra Build Variants attraverso View > Tools Windows > Build Variants dal menu in alto.

    • In the Build Variants window, make sure that in the Active Build Variant column, the :editor entry is set to one of the Debug variants.

    ../../../_images/android_studio_editor_build_variant.webp
    • Aprire la finestra Run/Debug Configurations cliccando su Run > Edit Configurations... nel menu in alto.

    • Nella finestra Run/Debug Configurations , selezionare la voce editor e in Debugger assicurarsi che Debug Type sia impostato su Dual (Java + Native)

    • Click the + sign under the Symbol Directories section, and add the platform/android/java/lib/libs/tools/debug directory.

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

Compilazione e debug del modulo app

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

  • Per compilare il modulo app:

    ../../../_images/android_studio_app_configurations_drop_down.webp
  • Per effettuare il debug del modulo app:

    • Aprire la finestra Build Variants attraverso View > Tools Windows > Build Variants dal menu in alto.

    • In the Build Variants window, make sure that in the Active Build Variant column, the :app entry is set to one of the Debug variants.

    ../../../_images/android_studio_app_build_variant.webp
    • Aprire la finestra Run/Debug Configurations cliccando su Run > Edit Configurations... nel menu in alto.

    • Nella finestra Run/Debug Configurations, selezionare la voce app e in Debugger assicurarsi che Debug Type sia impostato su Dual (Java + Native)

    • Click the + sign under the Symbol Directories section, and add the platform/android/java/lib/libs/debug directory.

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

Se ci si imbatte in qualsiasi problema, chiedere aiuto in uno dei canali di sviluppo per Android di Godot.