Skip to content

Automate Android & Java SDK setup - #121849

Open
m4gr3d wants to merge 1 commit into
godotengine:masterfrom
m4gr3d:use_android_cli_for_setup
Open

Automate Android & Java SDK setup#121849
m4gr3d wants to merge 1 commit into
godotengine:masterfrom
m4gr3d:use_android_cli_for_setup

Conversation

@m4gr3d

@m4gr3d m4gr3d commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What problem(s) does this PR solve?

This PR introduces the AndroidSDKManager class which is used to automate the download, setup and management of the Android and Java SDK in the Godot editor.

  • Android SDK setup:
    • AndroidSDKManager checks whether export/android/android_sdk_path in the Editor Settings is valid.
    • If not, it prompts the user to download and set up the Android SDK.
    • If the user accepts, AndroidSDKManager downloads and uses the Android CLI to query, set up and update the Android SDK packages used by the Godot editor.
    • The install is done in a location specific to the Godot editor, and export/android/android_sdk_path is updated once the set up is complete with the new location.
  • Java SDK setup:
    • AndroidSDKManager checks for the presence of a valid Java SDK at the path specified by export/android/java_sdk_path in the Editor Settings.
    • If the install is invalid or missing, it prompts the user to download and set up the Java SDK.
    • If the user accepts, AndroidSDKManager downloads and sets up a version of the Java SDK from https://adoptium.net/.
    • The install is done in a location specific to the Godot editor, and export/android/java_sdk_path is updated once the set up is complete with the new location.
Screen.Recording.2026-08-10.at.12.37.10.PM.mov

The feature is can be accessed from two locations:

  • It shows in the Export Presets window when an Android preset is added, and the editor detects that the Android / Java SDK is not valid.
Screenshot 2026-08-10 at 12 14 20 PM
  • The Install Android Build Template... in the Project menu was renamed to Setup Android Build.... The updated button triggers the prompt for installing the Android / Java SDK when it detects they are not properly set up.
Screenshot 2026-08-10 at 12 20 30 PM

Advanced users still have the ability to set up and configure the Android and/or Java SDK on their own if desired.

Remaining TODOs:

  • Testing and validation on Windows
  • Testing and validation on Linux
  • Testing and validation on MacOS
  • Check for online access prior to downloading SDKs

@m4gr3d m4gr3d added this to the 4.8 milestone Jul 28, 2026
@m4gr3d
m4gr3d requested review from a team as code owners July 28, 2026 07:57
@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch 2 times, most recently from 6941810 to f7218b5 Compare July 28, 2026 08:05
@syntaxerror247

syntaxerror247 commented Jul 28, 2026

Copy link
Copy Markdown
Member

The feature is made available in the Export Template Manager via the addition of a new Setup Android SDK button.

This doesn't seems like the right place for this button.
@m4gr3d I think, it might be better to place this button directly in Android preset. Thought?

Or, we can also go with the approach we had discussed:

  1. Update this menu option to "Setup Android Build Environment"
image
  1. And update this dialog to also have a button "Setup Andorid SDK" (if it's not already installed).
image

@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch 3 times, most recently from 0316cb0 to 9e543e0 Compare July 28, 2026 10:14
@m4gr3d
m4gr3d requested a review from a team July 28, 2026 10:23
@m4gr3d

m4gr3d commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

This doesn't seems like the right place for this button.
@m4gr3d I think, it might be better to place this button directly in Android preset. Thought?

Both the Install Android build template button and the export presets are project specific, whereas the Java and Android SDK are editor-wide setups. For that reason, the primary access needs to leave alongside other editor-wide settings / buttons / features.
The export preset window does surface the Manage Export Templates button when the Android / Java SDKs are not properly set up, which opens the 'Export Template Manager' allowing the user to complete the setup.

Suggestions for other locations are welcomed though. And I welcome input from the @godotengine/usability team.

@m4gr3d

m4gr3d commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

I'm running into errors extracting the Java SDK when testing on Windows.. Will dig into the issue tomorrow.

@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch from 9e543e0 to a1e8c10 Compare July 28, 2026 10:39
Comment thread editor/export/android_sdk_manager.cpp Outdated
@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch 2 times, most recently from d8c6994 to dd1be84 Compare July 29, 2026 01:22
@m4gr3d

m4gr3d commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

I'm running into errors extracting the Java SDK when testing on Windows.. Will dig into the issue tomorrow.

Fixed the issue on Windows, and validated the feature works as expected.

@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch from dd1be84 to 8410480 Compare July 29, 2026 01:50
@Calinou

Calinou commented Jul 29, 2026

Copy link
Copy Markdown
Member

The class should be called AndroidSDKManager rather than AndroidSdkManager to be consistent with existing classes such as HTTPRequest or WebRTCDataChannel.

@m4gr3d

m4gr3d commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Feedback from discussions with @dsnopek and @syntaxerror247:

  • Rename Install Android Build Template... to Setup Android Build
  • Update the button logic to check for the Android SDK, and prompt the user for install if it's not already installed.
  • Move the Setup Android SDK button in Automate Android & Java SDK setup #121849 from the Export Template Manager to the Export Window. It should be surfaced as a link similar to what we do for the Manage External template link

@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch from 2bb3aec to 6cf03be Compare August 6, 2026 16:46
@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch from 6cf03be to 3ec23f2 Compare August 6, 2026 18:06
@m4gr3d
m4gr3d marked this pull request as draft August 6, 2026 18:06
@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch 3 times, most recently from 9560db6 to 49d9c9e Compare August 7, 2026 08:49
@m4gr3d
m4gr3d marked this pull request as ready for review August 10, 2026 19:40
@m4gr3d
m4gr3d requested a review from dsnopek August 10, 2026 19:40
@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch 2 times, most recently from c814b3e to 0ccc595 Compare August 10, 2026 20:38
@syntaxerror247

Copy link
Copy Markdown
Member

Needs a rebase

@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch from 0ccc595 to 54c5a31 Compare August 20, 2026 17:16
Comment thread editor/export/android_sdk_manager.cpp
Comment thread editor/export/android_sdk_manager.cpp
Comment thread editor/export/android_sdk_manager.cpp
Comment on lines +394 to +395
if (!AndroidSDKManager::is_java_sdk_setup()) {
setup_android_java_sdk->set_text(TTRC("Setup Java SDK"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!AndroidSDKManager::is_java_sdk_setup()) {
setup_android_java_sdk->set_text(TTRC("Setup Java SDK"));
if (!AndroidSDKManager::is_java_sdk_setup() && !AndroidSDKManager::is_android_sdk_setup()) {
setup_android_java_sdk->set_text(TTRC("Setup Android Build"));
} else if (!AndroidSDKManager::is_java_sdk_setup()) {
setup_android_java_sdk->set_text(TTRC("Setup Java SDK"));

@m4gr3d m4gr3d Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting to change the label when both SDKs are not set up? I'm not sure I see what difference that would make.

@syntaxerror247 syntaxerror247 Aug 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

When both is missing it only says Setup Java SDK which looked a bit odd to me. When pressed, dialog will also later popup to setup Android SDK, so it seemed correct to say Setup Android Build in this case. It's not a big deal anyways, so proceed as you like.

@m4gr3d
m4gr3d force-pushed the use_android_cli_for_setup branch from 54c5a31 to 07d2efe Compare August 23, 2026 00:51

@syntaxerror247 syntaxerror247 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works as expected (tested on Linux). This is a really great improvement to the Android build setup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants