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 ist eine kostenlose IDE für die Android-Entwicklung, die von Google und JetBrains entwickelt wurde. Es basiert auf IntelliJ IDEA und hat einen funktionsreichen Editor, der Java und C/C++ unterstützt. Es kann sowohl für die Arbeit an der Godot-Kern-Engine als auch für die Codebasis der Android-Plattform verwendet werden.

Projekt importieren

  • Wählen Sie im Begrüßungsfenster von Android Studio Öffnen.

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

Android Studio's Willkommensbildschirm.

  • Navigieren Sie zu <Godot-Stammverzeichnis>/platform/android/java und wählen Sie die Datei settings.gradle.

  • Android Studio wird das Projekt importieren und indizieren.

Android Studio Projektaufbau

Das Projekt ist mit den Modulen von Android Studio organisiert:

  • 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.

Bauen und Debuggen des Editormoduls

  • Um das Editor-Modul zu bauen:

    ../../../_images/android_studio_editor_configurations_drop_down.webp
  • Um das Editor-Modul zu debuggen:

    • Öffnen Sie das Fenster Build Variants mit View > Tools Windows > Build Variants aus dem oberen Menü.

    • 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
    • Öffnen Sie das Fenster Run/Debug Configurations, indem Sie im oberen Menü auf Run > Edit Configurations... klicken.

    • Wählen Sie im Fenster Run/Debug Configurations den Eintrag editor und stellen Sie unter Debugger sicher, dass der Debug-Type auf Dual (Java + Native) gesetzt ist

    • 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

Bauen und Debuggen des App-Moduls

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:

  • Um das Modul app zu erstellen:

    ../../../_images/android_studio_app_configurations_drop_down.webp
  • Um das app-Modul zu debuggen:

    • Öffnen Sie das Fenster Build Variants mit View > Tools Windows > Build Variants aus dem oberen Menü.

    • 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
    • Öffnen Sie das Fenster Run/Debug Configurations, indem Sie im oberen Menü auf Run > Edit Configurations... klicken.

    • Wählen Sie im Fenster Run/Debug Configurations den Eintrag app und stellen Sie unter Debugger sicher, dass der Debug-Typ auf Dual (Java + Native) gesetzt ist

    • 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

Wenn Sie auf Probleme stoßen, bitten Sie um Hilfe im Godot Android Dev Channel.