Xuất File Apk Trong Android Studio

viglacerabahien.com requires that all APKs be digitally signed with a certificate beforethey are installed on a device or updated. If you use viglacerabahien.com AppBundles, you need to lớn sign only your app bundle before youupload it khổng lồ the Play Console, & Play App Signing takes care of therest. However, you can also manually sign your tiện ích for upload lớn Google Play andother tiện ích stores.

Bạn đang xem: Xuất File Apk Trong Android Studio

This page guides your through some important concepts related khổng lồ tiện ích signing andsecurity, how lớn sign your tiện ích for release to Google Play using viglacerabahien.com Studio,và how to lớn opt in khổng lồ Play App Signing.

The following is a high-cấp độ overview of the steps you might need to lớn take tosign & publish a new phầm mềm to lớn Google Play:

If instead your phầm mềm is already published khổng lồ the Google Play Store with anexisting ứng dụng signing key, or you would lượt thích to lớn choose the ứng dụng signing key for anew phầm mềm instead of having Google generate it, follow these steps:

This page also explores how khổng lồ manage your own keys for when uploading your appto lớn other ứng dụng stores. If you vì not use viglacerabahien.com Studio or would rather sign yourứng dụng from the command line, learn about how lớn useapksigner.

Note: If you are building an Wear OS tiện ích, the process for signing the app candiffer from the process described on this page. See the information aboutpackaging và publishing Wear OSapps.

Play App Signing

With Play App Signing, Google manages và protects your app's signingkey for you và uses it lớn sign your APKs for distribution. And, because appbundles defer building và signing APKs khổng lồ the Google Play Store, you need toopt in to Play App Signing before you upload your phầm mềm bundle. Doing solets you benefit from the following:

Use the viglacerabahien.com App Bundle & support Google Play’s advanced delivery modes.The viglacerabahien.com App Bundle makes your tiện ích much smaller, your releases simpler,và makes it possible khổng lồ use feature modules & offer instant experiences.

Increase the security of your signing key, và make it possible lớn use aseparate upload key to sign the app bundle you upload to lớn Google Play.

Note: Opting in to Play App Signing applies for the lifetime ofyour tiện ích. In order lớn ensure security, after you opt in you cannot retrieve sầu a copy of your app's signing key andyou can't delete it from Google's servers without deleting your phầm mềm.

Play App Signing uses two keys: the ứng dụng signing key & the uploadkey, which are described in further detail in the section about Keys andkeystores. You keep the upload key & use it to sign your appfor upload to the Google Play Store. By using a separate upload key you canrequest an upload key resetif your key is ever lost or compromised. Bycomparison, if you’re not opted in lớn phầm mềm signing with by Google Play and youthua kém your app’s signing key, you chiến bại the ability to lớn update your app.

When you are ready to lớn publish, you can sign your app using viglacerabahien.com Studio uploadit khổng lồ Google Play. The key with which you sign your phầm mềm becomes your app’supload key. Google uses the upload certificate lớn verify your identity, andsigns your APK(s) with your app signing key for distribution as shown in figure1.

If you bởi not already have sầu an app signing key, you can generate one during thesign-up process.

Note: When you opt in to lớn Play App Signing, you aren’t able totải về the signing key from Google. If you want lớn use the same signing keyacross multiple stores, make sure to lớn provide your own signing key when you optin to lớn Play App Signing, instead of having Google generateone for you.

Figure 1. Signing an phầm mềm with Play App Signing

Your keys are stored on the same infrastructure that Google uses to lớn store itsown keys, where they are protected by Google’s Key Management Service. You canlearn more about Google’s technical infrastructure by reading theGoogle Cloud Security Whitepapers.

When you use Play App Signing, if you thảm bại your upload key, or if itis compromised, you can contact Google lớn revoke your old upload key andgenerate a new one. Because your app signing key is secured by Google, you cancontinue to lớn upload new versions of your tiện ích as updates to the original ứng dụng, evenif you change upload keys. To learn more, read Remix a lost or compromisedprivate upload key.

The next section describes some important terms và concepts related lớn appsigning and security. If you’d rather skip ahead & learn how to prepare yourphầm mềm for upload to the Google Play Store, go khổng lồ Sign your tiện ích forrelease.

Keys, certificates, và keystores

When it comes to signing your phầm mềm, it’s important to underst& the concepts anddefinitions described below.


A public key certificate (.der or .pem files), also known as a digitalcertificate or an identity certificate, contains the public key of apublic/private key pair, as well as some other metadata identifying the owner(for example, name and location) who holds the corresponding private key.

When signing your phầm mềm, the signing tool attaches the certificate toyour tiện ích. The certificate associates the APK or app bundle lớn you andyour corresponding private key. This helps viglacerabahien.com ensure that any futureupdates to lớn your phầm mềm are authentic & come from the original author. The keyused to create this certificate is called the app signing key.

Xem thêm: Có Mom Nào Đẻ Ở Bệnh Viện Hồng Đức Có Tốt Không, Bệnh Viện Hồng Đức: Những Thông Tin Cần Biết

You can tải về the certificate for your app signing key và your uploadkey from the app signing page in the Play Console in order to register yourkey(s) with API providers. The certificate can be shared with anyone.It does not contain your private key.

Every tiện ích must use the same certificate throughout its lifespan in order forusers to be able lớn install new versions as updates lớn the phầm mềm. For more aboutthe benefits of using the same certificate for all your apps throughout theirlifespans, see Signing considerations below.

A certificate fingerprint is a short và chất lượng representation of acertificate that is often requested by API providers alongside the package namekhổng lồ register an app khổng lồ use their service. The MD5, SHA-1 và SHA-256 fingerprintsof the upload and app signing certificates can be found on the tiện ích signing pageof the Play Console. Other fingerprints can also be computed by downloading theoriginal certificate (.der) from the same page.

The following are the different types of keys & keystores you should understand:

App signing key: The key that is used to lớn sign APKs that are installed on auser's device. As part of viglacerabahien.com’s secure update model, the signing key neverchanges during the lifetime of your tiện ích. The ứng dụng signing key is private & mustbe kept secret. You can, however, cốt truyện the certificate that is generatedusing your tiện ích signing key.

Upload key: The key you use to sign the tiện ích bundle or APK before youupload it for phầm mềm signing with Google Play. You mustkeep the upload key secret. However, you can nội dung the certificate thatis generated using your upload key. You may generate an upload key in one of thefollowing ways:

If you provide the app signing key to lớn Google when opting in your new orexisting tiện ích, then you have the option lớn generate a new upload key during orafter opting in for increased security.If you bởi vì not generate a new upload key, you continue to lớn use your appsigning key as your upload key to sign each release.

Tip: To keep your keys secure, it’s a good idea to lớn make sure your appsigning key and upload key are different.

Java keystore (.jks or .keystore): A binary tệp tin that serves as arepository of certificates và private keys.

Play Encrypt Private Key (PEPK) tool: Use this tool to lớn export private keysfrom a Java Keystore & encrypt them for transfer to Google Play. Whenproviding the ứng dụng signing key for Google khổng lồ use, select the option toExport & upload a key from a Java keystore & follow the instructionslớn tải về & use the tool. Alternatively, select the option toExport và upload a key (not using a Java keystore) to lớn download, Đánh Giá,& use the PEPK tool’s open source code.

Sign your debug build

When running or debugging your project from the IDE, viglacerabahien.com Studioautomatically signs your ứng dụng with a debug certificate generated by the viglacerabahien.comSDK tools. The first time you run or debug your project in viglacerabahien.com Studio, theIDE automatically creates the debug keystore và certificate in$HOME/.viglacerabahien.com/debug.keystore, & sets the keystore và key passwords.

Because the debug certificate is created by the build tools và is insecure bykiến thiết, most tiện ích stores (including the Google Play Store) vày not accept appssigned with a debug certificate for publishing.

viglacerabahien.com Studio automatically stores your debug signing information in a signingconfiguration so you vị not have sầu to lớn enter it every time you debug. A signingconfiguration is an object consisting of all of the necessary information tosign your phầm mềm, including the keystore location, keystore password, key name, andkey password. You cannot directly edit the debug signing configuration, but youcan configure how you sign your release build.

For more information about how lớn build & run apps for debugging, see Buildvà Run Your App.

Expiry of the debug certificate

The self-signed certificate used lớn sign your tiện ích for debugging has anexpiration date of 30 years from its creation date. When the certificateexpires, you get a build error.

To fix this problem, simply delete the debug.keystore tệp tin stored in one ofthe following locations:

~/.viglacerabahien.com/ on OS X & Linux C:Documents và Settingsuser.viglacerabahien.com on Windows XP.. C:Usersuser.viglacerabahien.com on Windows Vista and Windows 7, 8, và 10

The next time you build & run a debug version of your tiện ích, viglacerabahien.com Studioregenerates a new keystore and debug key.

Sign your ứng dụng for release to lớn Google Play

When you are ready lớn publish your app, you need khổng lồ sign your app & upload itkhổng lồ an phầm mềm store, such as Google Play. When publishing your tiện ích khổng lồ Google Play,you should also opt in lớn Play App Signing. This section shows you howlớn properly sign your app for release và opt in lớn Play App Signing.

Generate an upload key và keystore

If you don't already have an upload key, which is useful when opting in to PlayApp Signing, you can generate one using viglacerabahien.com Studio as follows:

In the thực đơn bar, cliông chồng Build > Generate Signed Bundle/APK.In the Generate Signed Bundle or APK dialog, selectviglacerabahien.com App Bundle or APK và cliông xã Next.Below the field for Key store path, clichồng Create new.

On the New Key Store window, provide the following information for yourkeystore và key, as shown in figure 2.