Add APK Signature Scheme v2 in gradle for ReactNative

Google Play reject my react native app with error: ERROR (Jar signer CERT.RSA): No APK Signature Scheme v2 signature from this signer ERROR (APK Signature Scheme v2 signer #0): No JAR signature from this signer. It's look like a need to sign my app with v2 scheme but offical site have only manual for v1 scheme (https://facebook.github.io/react-native/docs/signed-apk-android.html) and it's not enough for google play.

How can I sign my react native app with v2 scheme?

Upvotes: 2

Views: 4327

Answers (2)

Will
Will

Reputation: 1640

You do not need to add v2SigningEnabled because it should be signed with v2 by default from Android Studio 2.2 and Gradle 2.2 onwards.

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.

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

You can check if your apk is already signed using the android apksigner build tool. On mac the command is something like:

❯ ~/Library/Android/sdk/build-tools/30.0.1/apksigner verify -v 1594191166.apk

For more info about checking if an apk is signed refer to this this answer.

Upvotes: 2

MatPag
MatPag

Reputation: 44813

You should have something similar in your gradle file if you followed the guide of ReactNative or the official Android guide.

enter image description here

In this way, when you run the command

cd android && ./gradlew assembleRelease

The APK will include both types of signing.

The important part is to add v2SigningEnabled true to the signing config.

Upvotes: 5

Related Questions