生成签名的 apk android 工作室

我是 Android 开发的新手,刚刚完成了我的第一个应用程序。我想在 android 工作室生成一个签名的 apk。我阅读了开发人员的文档,但不能理解其中的步骤。当我点击 Build>Generate Signed APK...时,它会显示一个对话框,询问以下内容:

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

我甚至不知道密钥存储库是什么,即使在谷歌上搜索了一下。当我选择 create new它要求我选择一个路径,并找到一个 .jks文件,我没有!有人可以解释和列出的步骤,以便生成一个签名的 apk。

248151 次浏览

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.

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

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
}
}
}
...

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

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

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.

  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.

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

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?

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.stack.imgur.com/k8Elg.png

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.

  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.