Android program signature packaging
Introduction to this section:
The penultimate section of Chapter 1. This section introduces you to how to package our program into an Apk file and sign our Apk! As mentioned in the previous section, the IDE we use in subsequent tutorials is Android Studio, so this section also explains AS (this will be the case later) (abbreviation) to package and sign the project!
1. What is a signature and what is its use:
Android APP requires us to use a certificate to digitally sign the application, otherwise it cannot be installed on the Android phone. Usually, when we debug and run on the mobile phone, AS will automatically use the default key and certificate to sign; but when we publish and compile for more than ten years, it will not sign automatically. At this time, we need to sign manually. Got it! Signing our APK has the following benefits:
1. Application upgrade: If you want users to seamlessly upgrade to a new version, then you must use the same A certificate is used to sign. This is because the system will only allow the installation of upgraded applications if they are signed with the same certificate. If you use a different certificate, the system will require your application to use a different package name, in which case it is equivalent to installing a completely new application. If you want to upgrade the application, the signing certificate must be the same and the package name must be the same!
2. Application modularization: The Android system can allow multiple applications signed by the same certificate to run in one process, and the system actually treats them as one For a single application, our application can be deployed in the form of modules, and users can independently upgrade one of the modules.
3. Code or data sharing: Android provides a signature-based permission mechanism, so one application can provide another application signed with the same certificate Expose your functions. Sign multiple applications with the same certificate and use signature-based permission checking to securely share code and data between applications. If different applications want to share data or code, they must run in the same process and be signed with the same certificate. ————The above content is excerpted from: Why does android need a signature
2. How Android Studio packages signatures:
Okay, because of learning this The courses are all for beginners, and the content of multi-channel packaging will be explained later! This section only talks about the simplest package signature By the way, the apk generated by default during debugging mentioned in 1 is in the app/build/outputs/apk directory! It is not the same as Eclipse. Eclipse is generated in the bin directory!
Okay, open the Hello World project on our AS and click on the menu:
①Build -> Generate Signed APK...
②A pop-up window will pop up. If there is no key, create one. If there is one, select the existing Key
③If not, we will create a new one and fill it in according to your needs. Related items:
④Okay, after clicking OK, you can see our password information. We may need to fill in the password. Fill in the following:
⑤Click Next:
⑥Click Finish and wait for a while. The following prompt will appear, indicating that the application has been packaged and signed successfully:
⑦ You can see that the packaged APK has been lying peacefully in our app directory:
⑧ In the seventh step, the package signature has been completed. If you want to verify the signature, you only need to enter the following cmd command
##Summary of this sectionThere are many ways to package Android APK, command line, or Gradle, ANT, MAVEN, etc. There are many methods. This section explains the simplest way to package signatures through the graphical interface. ! Okay, that’s it for this section. Have you got the simplest package signature method?