Godot3 - export Android Release mode

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GameVisitor

This is my setup :

Godot 3.0.6 (official export template)
Ubuntu 16 LTS
Java version (jarsigner, keytool…) oracle jdk 8

When exporting my game for debugging / 1 click on the phone, it works perfectly.
When using a release key (debug off) and adjusting the info in export dialog, the apk fails to be created with this error :

‘jarsigner’ returned with error 1
Export templates for this platform are missing/corrupted: Android

Sample of keytool usage:

keytool -genkey -v -keystore my-release-key-test.jks -keyalg RSA -keysize 2048 -validity 10000 -alias TestEngine

/usr/lib/jvm/java-8-oracle/bin/keytool -genkey -v -genkeypair -storepass mytest -alias myuser -keypass mypass -keystore my-release-key-test.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias TestEngine

keytool -genkey -v -genkeypair -alias myuser -keypass mypass -keystore my-release-key-test.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias TestEngine -sigalg SHA1withRSA

I already checked similar questions but none of the tips worked for me:

https://forum.godotengine.org/265/how-release-project-google-play-store-android-release-mode

https://forum.godotengine.org/30777/problems-with-the-after-export?show=30777#q30777

Any ideas… ?
Thx in advance

Following this thread I managed to get more details about my problem (using -d cmd line switch):

jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect

However when typing this :

keytool -list -keystore myKeystore.keystore

(store password : mytest)

the cmd returns success.

PS: Also tried the recommend sigalg in the link MD5withRSA that didn’t work…

GameVisitor | 2018-09-11 08:59

:bust_in_silhouette: Reply From: unfa

I had similar issues until I defined all keystores with user and password filled in both in Editor settings and in the Project Export settings.

Hey thx for your tip, tried it but it didn’t work (restarted the Editor, with debug on / off, runnable on / off)…
Any other suggestion ?

GameVisitor | 2018-09-02 06:53

That was my exact problem. Thanks unfa. I needed to put the alias and password in both the Editor Settings|Android and the Project Export page

ondesic | 2019-09-28 15:38

:bust_in_silhouette: Reply From: GameVisitor

Finally solved it ! (if it helps you, kindly vote it up with the arrow on the left)

As i continued my investigation, I tried the following 2 things:

Replaced the release password (should be -keypass parameter) with the keystore password ( -storepass ) then got this error:

Enter key password for monUser: Exception in thread "main" java.io.IOError: java.io.IOException: Input/output error
	at java.io.Console.readPassword(Console.java:314)
	at java.io.Console.readPassword(Console.java:352)
	at sun.security.util.Password.readPassword(Password.java:57)
	at sun.security.util.Password.readPassword(Password.java:40)
	at sun.security.tools.jarsigner.Main.getPass(Main.java:2125)
	at sun.security.tools.jarsigner.Main.getAliasInfo(Main.java:2066)
	at sun.security.tools.jarsigner.Main.run(Main.java:248)
	at sun.security.tools.jarsigner.Main.main(Main.java:116)
Caused by: java.io.IOException: Input/output error  

Cleared the Release user (-alias) and got this error :

jarsigner: Certificate chain not found for: .   must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

Then it hit me, Godot user interface export dialog, is asking for only 1 password
but we have 2 ==> solution : keypass and storepass MUST be equal (The same)

Once I did that, it worked, apk was generated, and upload to Google play store was also successful :slight_smile:

Cheers !