Android Studio

Android Studio is a free IDE for Android development made by Google and JetBrains. It's based on IntelliJ IDEA and has a feature-rich editor which supports Java and C/C++. It can be used to work on Redot's core engine as well as the Android platform codebase.

Importing the project

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

Android Studio's welcome window.

  • Navigate to <Redot root directory>/platform/android/java and select the settings.gradle file.
  • Android Studio will import and index the project.

Android Studio project layout

The project is organized using Android Studio's modules:

  • lib module:

    • Located under <Redot root directory>/platform/android/java/lib, this is a library module that organizes the Redot 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 <Redot root directory>/platform/android/java/editor, this is an application module that holds the source code for the Android port of the Redot Editor.
    • This module has a dependency on the lib module.
  • app module:

    • Located under <Redot 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.

Building & debugging the editor module

Image

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

Image

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

Image

Building & debugging the app module

The app module requires the presence of a Redot project in its assets directory (<Redot root directory>/platform/android/java/app/assets) to run. This is usually handled by the Redot Editor during the export process. While developing in Android Studio, it's necessary to manually add a Redot 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:

Image

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

Image

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

Image

If you run into any issues, ask for help in the Redot discord server

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.