The difference between the two signature mechanisms V1 and V2 of Android Studio

When Android Studio 2.2 and above packages apk, we will find that there are more signature versions (v1, v2) to choose from, as shown in the red box in the following figure

Problem Description (v1 and v2)

APK Signature Scheme v2 was introduced in Android 7.0, v1 is jar Signature from JDK.
V1: Should be verified by ZIP entry, so that many modifications can be made after the APK is signed - files can be moved and even recompressed.

V2: Validates all bytes of a compressed file, not a single ZIP entry, so cannot be changed after signing (including zipalign). Because of this, we now combine compression, adjustment, and signing into one step during compilation. The benefits are obvious, the more secure and new signature reduces the time to verify on the device (no time-consuming decompression and verification is required), resulting in faster app installation.


Solution one

The signatures of v1 and v2 are used
1) Only checking the v1 signature will not affect anything, but it will not use a more secure verification method on 7.0
2) Only checking the V2 signature below 7.0 will directly install it and show that it is not installed, and above 7.0 Then use the V2 method to verify

3) Check both V1 and V2, then all models will be fine


Solution two

Add the code shown in the red box below under the android tag of the app's build.gradle




Official description



personal suggestion

       This is a new signature mechanism that emerged from the Android 7.0 system. This new mechanism makes the apk signature method more secure. First of all, we should try to check both the V1 and V2 options and use them as much as possible, but If there is a problem after checking all of them, then we can ignore this new signature mechanism, only check the first option (V1), and still use our old signature mechanism.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325811288&siteId=291194637