-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the logic to sign prebuilt Godot Android apks #44645
Conversation
@godotengine/android This is being opened as a draft as the PR (especially the commands' names and extensions) still needs to be validated on Linux and Windows machines (I only have a mac with me at the moment). In addition, a couple Android editor settings are being deprecated for which I'd like feedback on. |
I tested this on Windows 10 and in all my build-tools versions (25-30) |
platform/android/export/export.cpp
Outdated
static String get_apksigner_path() { | ||
String exe_ext = ""; | ||
if (OS::get_singleton()->get_name() == "Windows") { | ||
exe_ext = ".exe"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be changed to: exe_ext = ".bat";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the executable extension optional on Windows thanks to its PATHEXT
environment variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but what this code does is actually try to find the tool, so you need the whole path incl. file extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m4gr3d Yes, that fixed it. I also exported an APK & did a quick install via the editor -> works.
a69d0fe
to
95ff39f
Compare
Not sure if this is related since this works now on Windows, but after quick-installing to an Android device i get this error in the Godot console:
|
95ff39f
to
ab08e97
Compare
@mbrlabs It was an unrelated bug, but this PR surfaced it. I've fixed the issue so the error should be gone now. |
@pouleyKetchoupp @RandomShaper Any chance you can validate this PR (and #44646) on a Linux machine? |
That's annoying :( But I guess there's no other way forward. |
platform/android/export/export.cpp
Outdated
// There are additional versions directories we need to go through. | ||
da->list_dir_begin(); | ||
String sub_dir = da->get_next(); | ||
while (!sub_dir.empty()) { | ||
if (!sub_dir.begins_with(".") && da->current_is_dir()) { | ||
// Check if the tool is here. | ||
String tool_path = build_tools_dir.plus_file(sub_dir).plus_file(apksigner_command_name); | ||
if (FileAccess::exists(tool_path)) { | ||
apksigner_path = tool_path; | ||
break; | ||
} | ||
} | ||
sub_dir = da->get_next(); | ||
} | ||
da->list_dir_end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How confident are we that the SDK structure will stay the same? Parts of it have changed every now and then causing breakage in build scripts, and it would be annoying to have users unable to export APKs because apksigner moved someplace else and our hardcoded detection logic can't find it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That directory structure has been stable for the past 4 years (since revision 24.0.3), so I don't expect it to change soon.
Nonetheless, we can add a setting entry specific to the apksigner
command, and only use the hardcoded logic above as a fallback in case the setting is not specified.
As we move more toward AAB
and custom build, that setting will be less and less relevant (since we leverage the gradle build process instead for these).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess let's go without extra setting for now and see how it evolves.
Needs a rebase. |
ab08e97
to
b91968f
Compare
|
b91968f
to
0b12484
Compare
The previously used tool, `jarsigner` has been deprecated in favor of `apksigner` which is bundled with the Android SDK. The logic is refactored accordingly and a few editor settings have been deprecated in the process as they're no longer necessary. Note: As a side effect, specifying the Android SDK path is now required. The docs will be updated to reflect that change.
0b12484
to
49969de
Compare
Thanks! |
The previously used tool,
jarsigner
has been deprecated in favor ofapksigner
which is bundled with the Android SDK.The logic is refactored accordingly and a few editor settings have been deprecated in the process as they're no longer necessary.
Note: As a side effect, specifying the Android SDK path is now required. The docs will be updated to reflect that change.
Fixes #44587
3.2 backport