Reprint please indicate source: http://blog.csdn.net/kjunchen/article/details/50812391
You can look directly at the following signature apps in Android studio
Android requires that all applications be digitally signed before they are installed. Android uses this digital certificate to determine the author of the application, but the certificate does not require the signature of a particular institution. Android typically uses its own signed certificate, and the developer himself holds the certificate's key.
You can use the signature in debug or advertise mode, in normal case, in debug mode, the Android SDK will generate a signed certificate for the application on its own initiative. However, in the announcement mode, you need to generate your own certificate to sign the application.
Applications that are signed in debug mode cannot be distributed externally.
Signature application in the announcement mode
1, create KeyStore. KeyStore is a binary file that includes a private key collection, please keep it in a safe and secret place.
2. Create a private key. A private key represents an organization or group that identifies an application, such as an individual or a company.
3. Add the signature configuration to the app module's build file:
...android { ... ... } signingConfigs { release { storeFile file("myreleasekey.keystore") "password" "MyReleaseKey" "password" } } buildTypes { release { ... signingConfig signingConfigs.release } }}...
4. Request Assemblerelease build task from Android Studio.
The app/build/apk/app-release.apk file in the package is the publication of the signature package.
Note : It is not safe to include passwords in the build file. So the password you want to configure in the build file can be obtained from the system environment variable or the process hint.
Get from environment variables:
storePassword System.getenv("KSTOREPWD")keyPassword System.getenv("KEYPWD")
From the command line for the process prompt:
storePassword System.console().readLine("\nKeystore password: ")keyPassword System.console().readLine("\nKey password: ")
Once you're done, you're ready to announce your app in the marketplace.
warning : You must ensure the security and privacy of keystore and private keys and secure backups.
Suppose you post in the app market. You will not be able to make any updates if you lose the KeyStore of your signature application, and you must use the same key for signing all the version numbers of the app.
Signing apps in Android Studio
1. Click on the menu bar Build > Generate signed APK.
2. In the Generate Signed APK Wizard form, Click Create New to make a fresh signing certificate. Assuming that there are already keystore able to enter the 4th step directly.
3. In the New Key Store form, provide the appropriate information. Suppose your key has a validity period of 25 years. Then your app must use the same key for updates within the validity period.
(Note: Multiple keys can be included in a key store)
4. In the Generate signed APK Wizard form, select a KeyStore, a key. Enter your password, then click Next.
5. In this form, select a location to save the signature app and click Finish.
Wait a moment and Android studio will pack it up for you.
All right, this is the application of signature packaging, go to an application market to distribute it.
Welcome to Q Group discussion: 365532949
Android Studio Signature Packaging app