简体   繁体   中英

Can't generate Android APK signed with APK v2 scheme

I'm trying to build an APK which is signed with new v2 scheme. I'm using Android studio 2.1.3 also tried with Android 2.2 RC, gradle version that i have been using is 2.1.3. Changed the compiled version to api 24 and build tools to 24.0.2 but still can't generate apk with v2.

I tried checking the app using the following command, adb shell pm dump | grep apkSigningVersion

Everytim i get 'apkSigningVersion=1' and also can't find the magic “APK Sig Block 42” in the apk itself.

All i'm trying to do is generate an apk signed with v2 scheme. Can generate old jar signed v1 apks without any problem.

I want to know

  1. what changes should I make to generate v2 singed apk's other than compiler changes.
  2. Is there a tool to convert v1 signed old apk's to convert into v2 scheme.

Thanks in advance

Taken from https://developer.android.com/about/versions/nougat/android-7.0.html#apk_signature_v2 :

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.

As this text states, you need to use Android Studio 2.2 (currently available as beta) and also update the Android Plugin for Gradle to the latest version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM