Home » Android » google play – Sign Android APK with a certificate that expires further in to the future

google play – Sign Android APK with a certificate that expires further in to the future

Posted by: admin June 15, 2020 Leave a comment

Questions:

I have built an android app using phonegap build. I am now trying to get this on the play store but keep getting the following error

You uploaded an APK signed with a certificate that expires too soon. You need to sign your APK with a certificate that expires farther into the future

I have created the signing key with java jdk1.8.0 keytool and I have used this code

keytool.exe -genkey -v -keystore release.keystore -alias TicTacToe -keyalg RSA -keysize 2048 -validity 10000

I don’t understand. As far as I can tell I am setting the date 10,000 days from now which should be plenty?

How to&Answers:

Set expiration to be greater than 50 years.

-validity 20000

Answer:

Important Note: Don’t attempt to use a purchased code signing Certificate!

If you come from the Windows app/application development world it is natural to assume that you want to use a purchased code signing certificate.

That is possible but when you or your client attempts to submit the application to the Google play store it will fail with the ‘APK signed with a certificate that expires too soon‘ error. That is because the max validity of most purchased certificates is around 2/3 years.

The solution is to just generate your own certificate as explained by others. I picked a validity of 100 years and it worked just fine. I am pretty sure I won’t be working on this app in 100 years.

The disconnect is because the certificates are used in a different way and for a different purpose. Rather then identifying and naming the developer, the self generated certificate is used to ensure that two application versions came from the same but unnamed source.

The full details can be found in: https://developer.android.com/studio/publish/app-signing.html

Answer:

try to use that:
keytool.exe -genkey -v -keystore release.keystore -alias TicTacToe -keyalg RSA -keysize 2048 -validity 20000

Answer:

If you work with Flash Builder and you are getting this message when uploading to the Play Store, make sure you upload an .apk generated by going to Project > Export Release Build… instead of a normal .apk generated by a run of your project.

I had generated a correct certificate but I still got the same error message until I did this. Just in case somebody has the same problem…