Android Studio update package encounters V1 (Jar Signature), V2 (full APK Signature) issues

Source: Internet
Author: User

Yesterday updated Android Studio packaging encountered two check box, and began to understand ...

Problem

At first the default is to tick V2 (full APK Signature), and then I'll pack to test first and find the installation failed. Later found to have a relationship with the signature.

Found

Android 7.0 introduced apk Signature Scheme V2 (full apk Signature), V1 (Jar Signature) from the JDK

Difference between the two

V1: Verify the contents of the uncompressed file only, so that many changes can be made after the APK is signed to move or even re-compress the file.

V2: Validates all the bytes of a compressed file, not a single ZIP entry, and therefore cannot be changed (including Zipalign) after signing. Because of this, we are now in the process of compiling, merging the compression, adjustment, and signing into one step.

Benefits of V2: more secure and new signatures shorten the time to validate on the device (eliminating the need for lengthy decompression and verification) to speed up application installation. If any custom tasks tamper with the apk file or post-process it (in any way), then the V2 signature is at risk of being invalidated, resulting in an incompatibility between your apk and Android 7.0 and later.

How to use

1, packaging signature only tick V1 signature does not affect what, but in 7.0 will not use a more secure authentication method;

2, only check V2 signature 7.0 The following will be installed directly after the display is not installed, more than 7.0 use the V2 way to verify

3, at the same time tick V1 and V2 All models are no problem.

Warm tips

//为了方便我们每次打包,我们可以设置每次打包默认两个都勾选。在app所对应的build.gradle添加如下配置,//再sync Now  即可signingConfigs {    debug {        v1SigningEnabled true        v2SigningEnabled true    }    release {        v1SigningEnabled true        v2SigningEnabled true    }}
To make it easy for us to pack each time, we can set a default of two each time the package is checked. Add the following configuration to the Build.gradle of the app,
Then sync now  
Signingconfigs {
Debug {
v1signingenabled true
v2signingenabled true
  }
Release {
v1signingenabled true
v2signingenabled true
  }
}



From for notes (Wiz)



Android Studio update package encounters V1 (Jar Signature), V2 (full APK Signature) issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.