-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Use the editor-defined Android keystore for both debug and release mode #39207
Use the editor-defined Android keystore for both debug and release mode #39207
Conversation
This paves the work for making release mode the default export option, since it performs better and results in smaller binaries. The "debug" keystore option was renamed to "default" in the Editor Settings. People using older configuration files will have to update their editor settings to follow the rename. The OpenJDK-related messages now specify that version 8 is required (and that more recent versions won't work).
@@ -1764,16 +1764,16 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { | |||
|
|||
if (!FileAccess::exists(js)) { | |||
valid = false; | |||
err += TTR("OpenJDK jarsigner not configured in the Editor Settings.") + "\n"; | |||
err += TTR("OpenJDK 8 jarsigner not configured in the Editor Settings.") + "\n"; | |||
} | |||
|
|||
String dk = p_preset->get("keystore/debug"); |
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.
We don't know whether the user will be exporting in release mode at this point. How could error checking be improved to take into account a situation where only a release keystore is defined in the export preset, but no default keystore is defined in the Editor Settings? Right now, this will be considered an error.
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 think it's fine to have an error in this case, given the way things are currently set up for debug and release.
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 like the idea of using a default keystore that can be used for both debug and release. It would be probably ok to cherry-pick for 3.2 as long as the documentation and error messages are explanatory.
I'm still compiling for Android, so I will finish the tests later, but in the meantime I've let some comments for a few things.
About making release the default export mode:
I'm not so sure about that part, since we might want to make sure users deploy a build with logs and errors by default.
Although, a nice alternative would be to be able choose between debug and release when clicking the android quick launch button.
Ideally, something like what Git Extensions use for Pull options would be great:
The button itself can default to the latest chosen option (or debug by default), and a drop-down list could allow launching debug/release.
edit: This comment about release as default export is only for the quick launch button. I think the changes in #39208 are fine as long as they affect only the export window.
@@ -1764,16 +1764,16 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { | |||
|
|||
if (!FileAccess::exists(js)) { | |||
valid = false; | |||
err += TTR("OpenJDK jarsigner not configured in the Editor Settings.") + "\n"; | |||
err += TTR("OpenJDK 8 jarsigner not configured in the Editor Settings.") + "\n"; |
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.
The documentation says JDK 6 or 8:
https://docs.godotengine.org/en/3.2/getting_started/workflow/export/exporting_for_android.html#setting-it-up-in-godot
Does it actually work only with version 8? Also I don't know if it's already in your plans, but the documentation could also be updated to explicitly say that versions above 8 would fail.
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 don't know if OpenJDK 6 is still supported by Godot for Android signing. Either way, it's very old and definitely EOL (just like OpenJDK 8, but that one is still commonly used in companies).
@@ -1764,16 +1764,16 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { | |||
|
|||
if (!FileAccess::exists(js)) { | |||
valid = false; | |||
err += TTR("OpenJDK jarsigner not configured in the Editor Settings.") + "\n"; | |||
err += TTR("OpenJDK 8 jarsigner not configured in the Editor Settings.") + "\n"; | |||
} | |||
|
|||
String dk = p_preset->get("keystore/debug"); |
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 think it's fine to have an error in this case, given the way things are currently set up for debug and release.
|
||
if (p_debug) { | ||
if (ep.step("Signing debug APK...", 103)) { |
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.
An explicit error message here when the keystore is not defined could help users, something like:
"No default keystore defined in Editor Settings and no debug keystore defined in Export settings, can't sign the debug APK."
(same thing for release)
EDITOR_DEF("export/android/default_keystore", ""); | ||
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/default_keystore", PROPERTY_HINT_GLOBAL_FILE, "*.keystore")); | ||
EDITOR_DEF("export/android/default_keystore_user", "androiddebugkey"); | ||
EDITOR_DEF("export/android/default_keystore_pass", "android"); |
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.
For some reason, when going to Editor Settings after compiling with these changes, I still have the old debug keystore settings showing on top of the new default keystore settings:
Maybe because of some cache?
That could be misleading for users at the moment this change happens, but I have no idea how to fix 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.
I also saw this happening when testing. It seems there's no "revert" button for unknown settings anymore, unlike what https://github.com/godotengine/godot/issues/22099 says.
cc. @m4gr3d in case he wants to share extra feedback. |
@Calinou I'm not sure I follow the reason for the change so a clarification may help, but what I'm seeing so far doesn't seem like a good idea for the following reasons:
As I mentioned, it may be that I misunderstood the reasons for this PR. If so, I'll be glad to corrected, but as it stands, this PR and PR #39208 are problematic. |
PS: The points below would be better discussed in #39208, since this PR doesn't change the default export mode. If we end up not agreeing on exporting in release mode by default, this PR could still be merged without merging #39208.
Try searching around on Reddit or the Godot Q&A, and you'll find many people who ran into performance issues or unexpectedly large binaries because they accidentally exported a debug build. I think exporting in release mode by default is generally what's expected, especially by casual developers. A lot of people I know will never bother with I understand professional developers will want to export in debug mode most of the time, but this should be handled by one-click deploy during development. If not, just check the "Export in debug mode" checkbox in the export dialog. Hopefully, a professional developer will have a harder time missing it 🙂 (that checkbox often goes unnoticed) Also, Godot has occasional issues with bugs popping up only in release mode, such as #28922. Exporting in release mode at the last minute may hide this kind of bug until you encounter it.
This change shouldn't affect one-click deploy in any way, as the debug argument is always That said, we could consider adding a way to use one-click deploy in release mode for cases where you absolutely need high performance during testing (or to check for bugs that only appear in release mode, as mentioned above).
While it obviously won't work when uploading the APK to Google Play, it should still work fine on a local device. You can still define a release keystore override in the export preset. I wish we could add documentation for individual export preset properties, so we could further clarify this… |
I'm okay with making release the default mode to avoid the mistake of publishing debug builds. But we should also avoid the mistake of publishing with a debug keystore. The best way to manage this is to show an error message if the release keystore is missing and the user is trying to export as release.
I see this point not in terms that it doesn't work, but more about adding a default setting that most likely will induce users into making a mistake (that is, releasing with a debug keystore). Showing an appropriate error message will avoid the mistake, so it's better being annoying in this case. |
This paves the work for making release mode the default export option, since it performs better and results in smaller binaries.
The "debug" keystore option was renamed to "default" in the Editor Settings. People using older configuration files will have to update their editor settings to follow the rename.
The OpenJDK-related messages now specify that version 8 is required (and that more recent versions won't work).
I haven't been able to build for Android lately, so I'd like to have someone test this before it can be merged (just in case). cc @pouleyKetchoupp
PS: This change might be worth cherry-picking to the
3.2
branch as the keystore choice logic is a common point of confusion among newer Godot users.