I need help with being able to export to Android using Godot 3.5. The error I'm receiving is:
'apksigner' returned with error #1 (and also
error #2). I'm currently testing with an empty project to rule out my project being what's bugged.
I've followed the Exporting for Android instructions on Godot Docs v3.5:
- Installed OpenJDK 11 (the
JAVA_HOME System environment variable is correctly set, and Open JDK 11's /bin directory is also in the System's Path variable).
java --version gives "openjdk 11.0.2 2019-01-15, OpenJDK Runtime Environment 18.9 (build 11.0.2+9), OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)".
- Downloaded Android's command line tools and run the
sdkmanager setup command
- Created a debug.keystore file using
keytool (the OpenJDK 11 version) as shown
- Pointed Godot to both the debug.keystore file and Android's SDK directory.
- I've not tried is installing Android Studio because it shouldn't be needed using the command line tools method.
The first issue is that I get apksigner's error #1 with Godot's default keystore user/pass. The username must to be changed from "androiddebugkey" to "debug.keystore" to solve error #1. Why Godot can't see debug.keystore's alias of "androiddebugkey" and work as shown in the Godot Docs, I don't know. It should work using the alias, so maybe this is indicative of some underlying problem?
With error #1 seemingly solved, I then get stuck on
'apksigner' returned with error #2. It doesn't matter if I populate the Export dialogue's Debug, Debug User, and Debug Password fields with the correct values (or rather the only values which work for me (user/pass:
android), it just won't work.
Running Godot from the command line with
--verbose shows this output when
error #2 is displayed in Godot's UI:
Starting signing of the APK binary using D:/Android/SDK/build-tools/30.0.3/apksigner.bat
Signing debug binary using:
D:/Android/SDK/build-tools/30.0.3/apksigner.bat sign --verbose --ks C:/Users/user/.android/debug.keystore --ks-pass pass:android --ks-key-alias debug.keystore E:/godot/godot-docs/Test Project/Test Project.apk
The system cannot find the path specified.
Failed to load signer "signer #1": C:/Users/user/.android/debug.keystore entry "debug.keystore" does not contain a key
WARNING: Code Signing: 'apksigner' returned with error #2
at: add_message (editor/editor_export.h:251)
Failed to load signer "signer #1": C:/Users/user/.android/debug.keystore entry "debug.keystore" does not contain a key is interesting. Why would debug.keystore not contain a key? I'm using the command to generate one as shown in the documentation.
This debug.keystore is only temporary in an attempt to get things working, but here's the full output of what
keytool -v -list -keystore debug.keystore shows:
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: androiddebugkey
Creation date: 23 Aug 2022
Entry type: PrivateKeyEntry
Certificate chain length: 1
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 4b3b8fec
Valid from: Tue Aug 23 19:42:05 EEST 2022 until: Fri Jan 07 18:42:05 EET 2050
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
#1: ObjectId: 126.96.36.199 Criticality=false
0000: C3 3E 78 04 9B F8 5E 53 B0 67 6B 5D E1 F7 4F 68 .>x...^S.gk]..Oh
0010: D7 A7 BF EA ....
I'm not sure what I'm doing wrong. I managed to get Godot to export an Android project a year or two ago when attempting to learn Godot, but now I'm finding it impossible. What am I missing? Any help is appreciated!
- My Godot 3.5 is installed via Scoop.
- Android's command line tools is an extracted zip.
- OpenJDK 11 is installed using the MSI installer.
- Windows 11