Error when building Android build with release key

Hi,

I’ve created my own key to sign my game:

C:\Program Files\Android\Android Studio\jre\bin\keytool.exe" -genkey -v -keystore myapp.keystore -alias myapp -keyalg RSA -validity 999999

I introduced all the information as explained here https://coronalabs.com/blog/2014/08/26/tutorial-understanding-android-app-signing/

Tried to create an Android build with this key (asked for passwords and all of that, so looked cool), and got this:

14:24:49.432 Testing credentials for 'C:\Users\sergi\myapp.keystore': 14:24:50.583 Picked up JAVA\_TOOL\_OPTIONS: -Duser.language=en 14:24:50.583 jar signed. 14:24:51.665 Excluding specified files from build: 14:24:51.665 excluding: LaunchScreen.storyboardc 14:24:51.665 excluding: Icon.png 14:24:51.665 excluding: Icon-\*dpi.png 14:24:51.665 excluding: Images.xcassets 14:25:56.410 BuildID: 5c9390a53f99c 14:25:56.704 WebServices: downloading build 14:26:02.077 Android build failed (1) after 71 seconds

I’ve tried with different keys and applications, and I’m getting the same problem.

I’m using the latest stable version of Corona (2018.3326)

Just tried with 2019.3470 too, and same problem.

Still same problem today.

I don’t know Unity much, but just tried to create a hello world there and sign the apk with the same key/keystore, and upload it to the Google Play console (which didn’t allow me to upload unless the apk was signed with a non-debug keystore), and it was fine. So it doesn’t look like a problem with the keystore(s) I tried.

I love how convenient is having a build server, but the way Corona creates builds is a bit opaque and there isn’t much control of what’s going on. I don’t even get a message about the error cause.

Hello!

A few days ago I uploaded 4 new apps for a client.

No problem.

Also I update live apps frequently without errors and problems.

Corona is not at it’s best lately but maybe you should check your methods again.

Sorry I can’t help more.

Okay, so it looks like it works after regenerating the keystore from the command-line instead of from Android Studio. Third try really, this time adding -keysize 2048 and a lower validity value (10000, previous was 999999). Not sure about why this works when signing with Unity, and even less sure about why the first keystore I tried, generated from Android Studio, doesn’t work with Corona.

Unfortunately the keytool command is horribly documented.  Oracle defaults -validity to 90 days. Google wants at least 25 years which is 9125 days. Your choice of 10000 gets you those 25 years plus some. There may be a limit of 5 digits for the validity parameter as 99999 is 273 years. There isn’t much reason to go to 999,999 or 2700 years. This could have been causing you the error.

Depending on the version of keytool you have, the keysize may be too small and Android Studio may be defaulting to something lot helpful. 2048 bits is a good value for the keysize!

Rob

Thanks Rob, that clarifies a lot.

Just tried with 2019.3470 too, and same problem.

Still same problem today.

I don’t know Unity much, but just tried to create a hello world there and sign the apk with the same key/keystore, and upload it to the Google Play console (which didn’t allow me to upload unless the apk was signed with a non-debug keystore), and it was fine. So it doesn’t look like a problem with the keystore(s) I tried.

I love how convenient is having a build server, but the way Corona creates builds is a bit opaque and there isn’t much control of what’s going on. I don’t even get a message about the error cause.

Hello!

A few days ago I uploaded 4 new apps for a client.

No problem.

Also I update live apps frequently without errors and problems.

Corona is not at it’s best lately but maybe you should check your methods again.

Sorry I can’t help more.

Okay, so it looks like it works after regenerating the keystore from the command-line instead of from Android Studio. Third try really, this time adding -keysize 2048 and a lower validity value (10000, previous was 999999). Not sure about why this works when signing with Unity, and even less sure about why the first keystore I tried, generated from Android Studio, doesn’t work with Corona.

Unfortunately the keytool command is horribly documented.  Oracle defaults -validity to 90 days. Google wants at least 25 years which is 9125 days. Your choice of 10000 gets you those 25 years plus some. There may be a limit of 5 digits for the validity parameter as 99999 is 273 years. There isn’t much reason to go to 999,999 or 2700 years. This could have been causing you the error.

Depending on the version of keytool you have, the keysize may be too small and Android Studio may be defaulting to something lot helpful. 2048 bits is a good value for the keysize!

Rob

Thanks Rob, that clarifies a lot.