[TIMOB-23803] Android N: Use APK Signature Scheme v2 for creating APK's
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2017-03-20T21:08:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | android, android-7, androidlib, apk |
Reporter | Hans Knöchel |
Assignee | Eric Merriman |
Created | 2016-08-22T21:24:27.000+0000 |
Updated | 2017-03-21T22:56:22.000+0000 |
Description
Android N offers a new way to create APK's:
{quote}
Android 7.0 introduces APK Signature Scheme v2, a new app-signing scheme that offers faster app install times and more protection against unauthorized alterations to APK files. By default, Android Studio 2.2 and the Android Plugin for Gradle 2.2 sign your app using both APK Signature Scheme v2 and the traditional signing scheme, which uses JAR signing.
Although we recommend applying APK Signature Scheme v2 to your app, this new scheme is not mandatory. If your app doesn't build properly when using APK Signature Scheme v2, you can disable the new scheme. The disabling process causes Android Studio 2.2 and the Android Plugin for Gradle 2.2 to sign your app using only the traditional signing scheme. To sign with only the traditional scheme, open the module-level build.gradle file, then add the line v2SigningEnabled false to your release signing configuration:
{quote}
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
v2SigningEnabled false
}
}
}
{quote}
Caution: If you sign your app using APK Signature Scheme v2 and make further changes to the app, the app's signature is invalidated. For this reason, use tools such as zipalign before signing your app using APK Signature Scheme v2, not after.
{quote}
More info: https://developer.android.com/about/versions/nougat/android-7.0.html#apk_signature_v2
Closing ticket as duplicate with reference to the above comment.