Chinmay Dabke
Chinmay Dabke

Reputation: 5140

Generate signed apk android studio

I am new to android development and just finished my first app. I want to generate a signed apk in android studio. I read the developer docs but couldn't understand the steps. When I click on Build>Generate Signed APK..., it shows me a dialog box asking the following:

Keystore path  //with two options create new and choose existing
Keystore password
Key alias
key password

I don't get what is keystore even after googling it. When I choose create new it asks me to select a path and locate a .jks file which I don't have! Can anyone please explain and list the steps in order to generate a signed apk.

Upvotes: 105

Views: 277822

Answers (12)

adarsh
adarsh

Reputation: 531

  1. Generate a signed APK file, open the Build menu from the toolbar and select Generate Signed Bundle/APK.enter image description here
  2. Select between creating an Android App Bundle and APK file. enter image description here
  3. Enter Key store path, Key store password, Key alias, and the Key password. enter image description here
  4. if you’re creating a Signed APK file in first time, you will have to create a new key store Click Create new.. below of Key store path. enter image description here
  5. Enter all information like Path, Password, Confirm password, Alias Name, Password, Confirm ,First name last name ,Organization unit ,Organization name, Country code, City, State. enter image description here
  6. You have filled in the details for the certificate, select OK and Then, select Next.
  7. You will now be able to see the destination of your Signed APK file. Below that, you will see two more options: Debug and Release. enter image description here
  8. There are two more checkboxes towards the bottom of the screen. Select V2 (Full APK Signature) and click Finish.

Upvotes: 1

Sandeep Dixit
Sandeep Dixit

Reputation: 1046

Dialog is slightly confusing when it asks for a Key Store Path. But this is actually where it will create Keystore. The label can be "save key store at : "

Comments inline.

enter image description here

However, you can add more than one key to the same Keystore. In that case, you may also choose an existing Keystore.

Please NOTE that Google Playstore makes it quite difficult to change signing keys after the first release. So make sure you choose a location that is safe and can be remembered. Note down location and password details somewhere.

Upvotes: 0

Zaid Pathan
Zaid Pathan

Reputation: 16820

Simple 5 visual steps:

Step 1: Click Build -> Generate Signed Build/APK

Build

Step 2: Choose APK -> Next APK

Step 3: Click Create new ... Create new ...

Step 4: Fill necessary details Fill

⚠️ Important Note: Make sure to store this keystore file safely, because same keystore file will be required for consecutive store upload.

Step 5: Choose build variant debug/release & Signature Versions (V2) enter image description here

All done, now your Signed APK will start building and should popup on bottom right corner once available. Click locate to get your signed APK file.

Easy?

Upvotes: 10

Shiva
Shiva

Reputation: 12592

Note: If its a React Native project

If you open the root project folder in Android Studio, you wont see the options suggested in other answers in this page.

enter image description here

Solution

Instead of the root folder I opened the packages/native/android folder. Then only I could see the options to build signed APK.

https://i.sstatic.net/k8Elg.png

Upvotes: 2

Karl Johan Vallner
Karl Johan Vallner

Reputation: 4310

Official Android Documentation on the matter at hand with a step-by-step guide included on how to generate signed APK keys in Android Studio and even on how to setup the automatic APK key generation in a Gradle build.

https://developer.android.com/studio/publish/app-signing.html

Look under the chapter: Sign your release build

Upvotes: 0

Tony Baby
Tony Baby

Reputation: 7296

  1. Go to Build -> Generate Signed APK in Android Studio.
  2. In the new window appeared, click on Create new... button.
  3. Next enter details as like shown below and click OK -> Next. enter image description here
  4. Select the Build Type as release and click Finish button.
  5. Wait until APK generated successfully message is displayed as like shown below.enter image description here
  6. Click on Show in Explorer to see the signed APK file.

For more details go to this link.

Upvotes: 18

Jackspicer
Jackspicer

Reputation: 1857

I dont think anyone has answered the question correctly.So, for anyone else who has the same question, this should help :

Step 1 Go to Build>Generate Signed APK>Next (module selected would be your module , most often called "app")

Step 2 Click on create new

Step 3 Basically, fill in the form with the required details. The confusing bit it is where it asks for a Key Store Path. Click on the icon on the right with the 3 dots ("..."), which will open up a navigator window asking you to navigate and select a .jks file.Navigate to a folder where you want your keystore file saved and then at the File Name box at the bottom of that window, simply enter a name of your liking and the OK button will be clickable now. What is happening is that the window isnt really asking you chose a .jks file but rather it wants you to give it the location and name that you want it to have.

Step 4 Click on Next and then select Release and Voila ! you are done.

Upvotes: 122

GaRRaPeTa
GaRRaPeTa

Reputation: 5598

The "official" way to configure the build.gradle file as recommended by Google is explained here.

Basically, you add a signingConfig, in where you specify the location an password of the keystore. Then, in the release build type, refer to that signing configuration.

...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            storeFile file("myreleasekey.keystore")
            storePassword "password"
            keyAlias "MyReleaseKey"
            keyPassword "password"
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...

Upvotes: 21

Thiago
Thiago

Reputation: 13302

you can add this to your build gradel

android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            storeFile file("my.keystore")
            storePassword "password"
            keyAlias "MyReleaseKey"
            keyPassword "password"
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}

if you then need a keyHash do like this via android stdio terminal on project root folder

keytool -exportcert -alias my.keystore -keystore app/my.keystore.jks | openssl sha1 -binary | openssl base64

Upvotes: 4

cubeloid
cubeloid

Reputation: 169

I had the same problem. I populated the field with /home/tim/android.jks file from tutorial thinking that file would be created. and when i would click enter it would say cant find the file. but when i would try to create the file, it would not let me create the jks file. I closed out of android studio and ran it again and it worked fine. I had to hit the ... to correctly add my file. generate signed apk wizard-->new key store-->hit ... choose key store file. enter filename I was thinking i was going to have to use openjdk and create my own keyfile, but it is built into android studio

Upvotes: 4

Ajay S
Ajay S

Reputation: 48612

Read this my answer here

How do I export a project in the Android studio?

This will guide you step by step to generate signed APK and how to create keystore file from Android Studio.

From the link you can do it easily as I added the screenshot of it step by step.

Short answer

If you have Key-store file then you can do same simply.

Go to Build then click on Generate Signed APK

Upvotes: 25

VJ Vélan Solutions
VJ Vélan Solutions

Reputation: 6564

Use Keytool binary or exe to generate a private keystore. Instructions here. You can then sign your app using this keystore. Keytool gets installed when you install Java.

NOTE: Save/backup this keystore because once you publish an app on play by signing it with this keystore, you will have to use the same keystore for any future updates. So, it's important that you back it up.

HTH.

Upvotes: 51

Related Questions