Note: To our own development of the app signature, it represents my own copyright, in the future to upgrade, you must use the same signature. The signature represents your identity (that is, keystore), and multiple apps can use the same signature.
If you do not know what the signature is, please own Baidu Oh. The way to sign in Eclipse is: Select project, mail Select "Export-android-export android Application",
1. Mode 1: Sign through Android Studio:
Select the app module and choose the menu bar "Build-generate signed apk":
The following screen appears:
, if you are using your signature for the first time, click the Red Box section to create a new signature, or if you have previously signed a file, select the Blue box section to import it. Then I'll select the red-framed part first:
, after clicking "Finish", you can see the bottom of Android Studio: Gradle is performing assemblerelease such a task as shown in:
After generating the signed apk, a prompt will appear:
2, Mode 2: Signed by the command line:
(1) Load key Store:
Let's first delete the APK file signed by the first method. Next, proceed to the second way to sign the command line.
Open the Project Stucture graphical interface:
, select the app module, then switch to the Singning tab bar, then click Add, then generate the release signature information , followed by click "OK". Then do the following:
, switch to the Build Types tab and select signing config as "release" to configure the release signature information that was just generated.
After the operation is complete, we can see that the Build.gradle file of the app module has the following code in the Red-box section:
Then execute "Build-clean Project" on the menu bar:
(2) Generate Realease version of APK:
Immediately after the command line terminal enter the following command: (as has the command line terminal integrated into the software)
gradlew assembleRelease
If the operation succeeds, the effect is as follows:
The generated signature good apk is in the following location:
3. Why use the Gradlew command instead of the Gradle command:
In the HelloWorld project directory there is a Gradle folder, under the Gradle/wrapper directory there is a gradle-wrapper.properties file, open it:
Represents the Gradle version information that HelloWorld this project relies on. The red Line says, if our project does not have Gradle, the software will download gradle according to this URL, finally know why the first time to open as will be so slow?
If we execute the gradlew command, we actually execute the above Gradle wrapper and find the Gradle 2.2.1 we have downloaded. If there are many projects now, but the Gradle version of each project is different, I will have to configure each version of the Gradle to the environment variables, and execute the Gradlew command, will avoid this trouble.
Source: http://www.cnblogs.com/gao-chun/p/4891275.html
Android:android Studio Signature Packaging in two ways (ZZ)