How do I sign my app bundle for Google play? - android

I am new to Android development, I just created a free little app that I would like to publish on the Google Play Store. I already uploaded my app bundle to the developer console, but I lack the signing process. I think the missing step is, from the developers tutorial, this one:
$ keytool -export -rfc
-keystore your-upload-keystore.jks
-alias upload-alias
-file output_upload_certificate.pem
What should I replace "your-upload-keystore.jks", "upload-alias", and "output_upload_certificate.pem" with? Furthermore, I haven't an .pem certificate, I just have the two .der certificates: deployment and upload that Google sent me. Am I missing something? Any help would be appreciated. Thanks.

If you don't already have a Keystore, you should go in Android Studio and go in Build > Generate Signed Apk or Bundle and click on "Create new", Write a name an alias and everything that the Keystore needs.
IMPORTANT: Don't forget to save your alias name and password somewhere, because you'll need theese things next time you'll use the Keystore.
IMPORTANT2: Once you signed the App, do a backup of the keystore, it's very important and if you lose it, you will not be able to update your own app, because Google App Store will request the same Keystore that you used for the first upload of your App, so don't forget, do a multiple backup and remember the alias and password.
If you have already a Keystore you should just select the Keystore instead creating a new one and insert the Alias Key and the Password, that's all!

The tools you need is just right on your IDE.
There are many ways you can generate a signed apk or bundle. what i prefer is Studio one.
Here is how you can generate one.
Step one :
Step Two :
Step Three:
if you have your keystore generated already then you can select one by clicking on choose existing button and move ahead if you don't have this generated then you can just create a brand new by clicking on create new button.
if everything is right then you can see your app bundle generated in app/release

Related

Google Play Console Play App Signing - The Android App Bundle was not signed

I am trying to create a playstore release.
I've followed the guide to create an upload key and keystore, to the letter: https://developer.android.com/studio/publish/app-signing#generate-key
I have then generated a signed app bundle of my app with the upload key, exactly as stated here: https://developer.android.com/studio/publish/app-signing#sign_release
Which resulted in a file named: app-release.aab
Now, because this app is brand new, and has never been released before, there is no need to export the encrypted key and "opt in an existing app into Play App Signing" as I already opted in to this when I created the new app listing in the play console and, of course, I've never uploaded an APK signed with another key for this app listing before.
Next, I go to the play console and create a new production release. When I upload the app-release.aab file however, I see the following error message:
"The Android App Bundle was not signed."
Which is completely baffling.
As far as I can tell, I have followed the instructions to the letter, and I have attempted to do some research on google but I'm finding no answers.
Could anyone with experience of this process help me?
EDIT:
What I did not understand about the entire process, was that I am asked to generate the upload key locally but never actually upload the key to the google play console - how on earth does Google know that the app is signed with the upload key, if they've never seen the upload key? But, no where in the documentation of generating the upload key is it stated that I am supposed to do anything with the locally generated key other than use it to generate the signed app bundle locally, which is exactly what I have done.
EDIT 2:
Here are screenshots showing the process I am following to create the upload key and generate a signed bundle of my app with the upload key:
And then, rather oddly, the result of running keytool -printcert -jarfile app-release.aab from the directory where the bundle is:
You can verify if the app bundle you upload to Play is signed by running locally one of the following commands:
Using jarsigner:
jarsigner -verify app.aab
Using keytool:
keytool -list -printcert -jarfile app.aab
If it says the file is "verified" (or you see the certificate being printed when using keytool), then you AAB is indeed signed. If it is, make sure you upload the right file to Play Console, and if it still doesn't work, contact the developer support.
If it says the file is not verified/signed, then make sure you have selected a keystore in Android Studio when you generated the signed bundle and ensure the build succeeds.
If all else fails, do a full Clean Project and try again.
how on earth does Google know that the app is signed with the upload key, if they've never seen the upload key?
Google simply extracts the certificate from the first APK or AAB you upload and considers this the upload certificate. Every subsequent upload will have to be signed with the same key, but the first one can be signed with anything.
I tried building a release package that was set to 'debuggable true' to upload to my test-channel, to debug the release key hash and got this problem. I thought I had ruined something trying to get the key hash with keytool and openssl, like that I changed something that made it stop working, but it was just because I made the release debuggable in the build.gradle buildTypes. Just a helpful thought to those who comes here next in case they have the same problem.
I had to rebuild the project before signing it.
I was having a similar problem (just a few days ago).
I was able to resolve my problem (and I don't know why) by running the following command on my .jks file and then going through Android Studio and generating the signed app bundle again.
$ keytool -list -keystore 'fakeNmae.jks' -storepass
fake-password-same-one-i-used-in-android-studio
Use the command exactly as you see it except of course replace your .jks file name with the one above (make sure it is between single quotes) and then add your password after the -storepass command.
Hope it helps you too.
Here's the entry I posted here on SO about the problem.

How do I set up and deploy a Unity application to Google Play using Play app signing and app bundles?

Using app bundles and play app signing is currently the way recommended by google to deploy new apps on google Play. And starting from August 2021 new apps will be strong-armed into using these formats.
How do I set this up in Unity, and how do I configure the app in Google Play?
I haven't gotten 2019.4 app bundle builds to sucessfully upload to play console, so it's probably a good idea to upgrade to the 2020.3 LTS before you start (as that's what finally worked for me.
Configuring Google Play App signing
First create a new app in Play Console, give it a name, accept terms etc.
Then, click Internal testing on the menu on the left side, and create a new internal release.
In the first question, click Change App Signing key, Use a different key and then select the third option, where you can upload your existing key (and an optional step with to add an upload key) to Google Play.
Now, don't just follow the instructions listed on Google Play, as you will end up with an upload key store that Unity doesn't know how to deal with.
Instead, using Unity, we will create two key stores and two keys. The first one is the app signing key, which you will only need to see once when uploading it to Google Play, then Google will take care of it and use it to do the final signing of your apps after you've uploaded your app bundles.
Go to Player settings → Publishing Settings → Keystore Manager → Create new in dedicated location
You don't need to fill out everything. Just the password, key alias and key password. It doesn't matter what you call the key. Don't configure Unity to use this key just yet (we'll create another key and keystore for Unity to use shortly).
Follow instructions 1.-3. on Google Play to upload this new key using the pepk tool.
Then, you need to create an upload key and keystore. Unity will use this key to sign your app bundles. Again, do NOT use the instructions on Google Play to create this key, instead use the Unity UI to create another key store that plays nice with Unity.
The passwords and alias could be whatever you want I named my key uploadkey, but make sure to keep the key store and passwords somewhere safe, you will need these later, or you'll have to create new keys and talk to Google support to reset it.
When prompted, click yes to configure your project to use this new key.
When you've created the key store and key export its public key to the .pem format...
keytool -export -rfc -keystore upload.keystore -alias uploadkey -file upload_certificate.pem
...and upload it to Google Play.
Click Update and then Continue in Play Console.
Play store should now be ready to accept your .aab files.
Configuring Unity
Hopefully, your project is now set up to sign using the upload key you just created.
Make sure to set the package name yourself by going to Player Settings → Other Settings Override Default Package Name . Type in something appropriate in lower-case characters only, the default package name has uppercase characters, which I think is just begging for problems. You can't change this later, or you'll have to create a new play store entry, so make sure it's something that's acceptable for customers to see, i.e. com.yourcompany.gamename.
It's also a good idea to enable 64-bit builds in player settings otherwise, google play will complain later. Switch Scripting Backend to IL2CPP and then tick ARM64:
Tick Build App Bundle in Build Settings.
Click Build and build your .aab file
Then upload it to the Google Play Console:
If you're lucky, everything went smoothly, and you can click save and be ready to start testing your app.
If not, you may get helpful error messages, in which case just follow them, if not and they're really non-descriptive (like "Couldn't upload. Try again."), then try temporarily uploading an .apk instead, as that sometimes gives better error messages, then switch back to .aab when you've solved the issue.
In Unity 2020.3 you can use a jks upload key in Unity that was generated in Android Studio and keep "Let Google manage your key..." selected.
To generate a key, install Android Studio and create an empty Android Studio project then once gradle settles down, choose Build > Generate Signed Bundle. When it prompts for a keystore, create a new one and save it where you want. Cancel out, then in Unity select the jks you saved as your keystore in publishing settings.
You should be able to generate an aab package in Unity using the jks as a custom keystore to upload and still let Google manage the signing key like they recommend.
After struggling with uploading an app bundle, I realized one extra thing :
Don't use any forbidden characters in your password for the keystore in Unity ! This includes spaces and brackets, maybe not only...
If in doubt, try creating the key with Java keytool command line and it will tell you your password contains characters that can't work... Even just type the command line into a terminal and you'll see your password makes the command line break !
keytool -genkey -keystore yourfile.jks -dname "n=Mark Jones, ou=JavaSoft, o=Sun, c=US" -alias android -keypass YOUR PASSWORD -storepass YOUR PASSWORD -keyalg RSA -keysize 2048 -validity 2000
Maybe special chars are allowed in the Unity key generation panel but not in keytool ! Unity should fix this issue, it was driving me nuts ;)
Peace :)
FOR ALL YOU BEAUTIFUL FOLK WHO GET STUCK AT THE LAST STEP! - READ THIS!
Blockquote
When you've created the key store and key export its public key to the .pem format...
keytool -export -rfc -keystore upload.keystore -alias uploadkey -file upload_certificate.pem
...and upload it to Google Play.
Blockquote
Click Update and then Continue in Play Console.
THIS part drove me NUTS trying to figure out what the hell you meant by that. I know it's down to the fact that I'm a complete noob at this but the rest of the tutorial was AMAZING!
So let me clarify for those newbies (like me) who might lose the plot when they get to the last step and can't figure out what the hell to do.
At this point in the tutorial:
Blockquote
and upload it to Google Play. Click Update and then Continue in Play Console.
Here is what you have to do.
If you have already uploaded the FIRST signing key you were asked to make in unity (NOT the upload one), then simply go back to the INTERNAL TESTING page and refresh it.
Click CHANGE APP SIGNING KEY and then select the third option again: "Export and upload a key from Java keystore"
Click UPLOAD GENERATED ZIP and upload the .zip file that was created during the first steps.... I named mine output.zip
At STEP 4 you will see a link called "SHOW INSTRUCTIONS" - Click the link and upload your public upload certificate that was generated in the last step. The file ending with the .pem format
Click SAVE and it should work.
NOW the next part got me. I didn't know what to do from here. The project is ready to accept the .aab files but DO NOT DO THIS JUST YET!
Learn from Mr Impatient himself (that's me), read the rest of the tutorial. Changing the file name to all lowercase is good practice to prevent issues later with CamelCaseFileNames.
FINALLY
You might get an error that says your target Android API is too low. Simply go to the UNITY PROJECT > FILE > BUILD SETTINGS > PLAYER SETTINGS > OTHER SETTINGS > and half way down the page change MINIMUM API LEVEL to "31" or above as instructed by the Google Prompt you WILL get if you ignore this :)
You can do this through Unity, it will download the latest version of the Android SDK (it opens a powershell terminal - DO NOT CLOSE THIS).
Once that's done, and you've completed all the steps listed above, then and ONLY THEN are you ready to compile your .aab file and upload it to the Google Play Console.
Finally, I want to thank the author of this tutorial BobbaLuba for his amazing efforts. After 7 hours of messing around in Unity -> Android Studio -> Google Play and almost abandoning the thought of releasing my app on Google .... it worked!
You are amazing sir. I tip my hat to you. Keep doing what you do. I for one, am eternally grateful .... I am emotionally, mentally and physically drained. I'm off to bed. Thanks again!
Good luck my little code monkeys!
Peace out
- NewbNinja

Lost my keystore password and key password,. but have the pepk file and the jks file, need to update the app

I just updated my android studio to 4.0, I didn't store the passwords anywhere., Its just the same .jks key am using to sign the apk, and Now I am not able to generate signed apk. 1 week before I generated the app using the same key, and it worked. Now not., I tried searching in logs. no use,. I tried searching in taskHistory and executionHistory.
Another problem is If I click generate signed apk, nothing is happening now. But I am able to create new keystore and generate the apk.
I just found my keystore password. by typing this command.
keytool -list -v -keystore "C:\Users\User1\Desktop\try\keystoreone.jks"
It asked for keystore password, and I tried one by one, and my usual password worked, the keystore file opened to reveal the details. But how do I find the key alias password?
If youre enrolled in App Signing by Google Play then you can just contact support and send them a new pepk or pem otherwise you will have to create a new app.

I can't upload the app to google play

I bought an application but when I upload it to the google play this message appears
I have searched a lot and nothing has worked out. I would like some help
You have to make build with keystore used to make build which is currently live on developer console.
WHen you say you bought an application, do you mean you bought an application already on the play store? If so, they should have given you the signing key and passwords. Use that to sign your app. If they didn't, you need to get it from them. If they don't have it, you need to contact google. Good luck with that, as you'll need to prove somehow you're the new owner. You really better hope they gave you or have the key.
Problem : maybe you not chose the signatures v1 v2
https://i.stack.imgur.com/yhIqB.jpg
As already mentioned, the key you generated the apk with is not to the one it should have, so you made some mistake at generating the signed apk in Android Studio by missing your key file. So you maybe just created a new one instead of using the old one
You have not signed the application with a different .keystore file.
If you are using xamarin the keystore file path;
C:\Users\your user name\AppData\Local\Xamarin\Mono for Android\Keystore
if you are using android studio, you must find your previous keystore.jks file. This file must have same md5 your error said.
You can see your keystore files md5 and sha1 codes with this command;
keytool.exe -list -v -keystore "%LocalAppData%\Xamarin\Mono for Android\debug.keystore" -alias youralias-storepass yourkey-keypass yourkey

SHA1 is changed after I changed my laptop

I have a running application in Play Store. I've tested and successfully updated my application three times. Suddenly, I had to change my laptop and reconfigured everything, i.e. Android Studio, JDK, SDK and everything. I knew that the signed key file is important for updating my application. So I backed up my project and the file.
Now I'm going to update my application again and I've noticed that my SHA1 key is changed. I cannot test my G+ login integrated with my app. I think that same problem will arise in GCM also. What should I do?
The Play Store and its APIs were all given the SHA1 of the debug key from your original setup, and that's what it's still expecting.
The easiest thing to do, if possible, is copy the debug key from your old setup to your new setup and rebuild with it. That file is in ~/.android/debug.keystore.
If you don't have your old key available any more, you will have to repeat the process you originally went through to connect your debug builds to whatever Google APIs you use. But this time with the SHA1 of your new key to replace the old key that's no longer being used.
You just need two steps to make your app up and working again:
1) Get your new SHA1 key.
2) Make the changes in the credentiials by going to console.developer.google.com where you have created the API key for signing your application.
Now how you are going to get the updated SHA1 key, for that go to the android studio click on View-> Tool Windows-> Gradle. Open the file with your app name on it and "(root)" written next to it then go to Run Configurations and click on one of the file that you see. That's it you will get your new SHA1 key and MD5 there at the bottom where the configurations are executed.
Update your API key with this SHA1 key and you are good to go!:)
Note: If you can't see the SHA1 key then there is a button next to run button named "Toggle tasks execution/text mode" click on that and you will get the key.
I had the same problem when lost my old pc.
Your app is secure in google play store as the keystores.jks stores the original ShA-1 that identifies your app-identity. If you lost your keystores then you will face others problemas. Here we will resolve the different Sha-1 problem.
The problem you are facing is relative to the debug, as the sha-1 is generated from your pc and its not equal to the one you previously informed.
You need 3 steps:
STEP 1 - Get your new Sha-1.
-Get the path to your new key. Its is in: C:\Users\YOURUSER.android
use this comand in terminal or command prompt -> keytool -list -v -keystore "C:\Users\YOURUSER.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
Copy the sha-1.
STEP 2 - Go to google developers console, find your credentials. Some of them are restricted. Enter in its properties and add the new SHA-1 in the list. Leave the old ones there too. Do it in every restricted credential.
STEP 3 - Go to your firebase console, settings. Then in Apps Android, just add the new SHA-1. This will make work.

Categories

Resources