Skip to main content
Up and Coming
August 18, 2017

How to sign Gear VR APK using Signature Scheme V1?

Reposted from Unity Forums.

Hi,

I'm using Unity 2017.2b but this error also occurred in 2017.1. I'm trying to build an APK for distribution in the Oculus store. Signed APKs nowadays are generated using Signature Scheme V2, which Oculus does not support. The Android documentation says that in order to use V1, you must add "v2SigningEnabled false" to your Gradle file.

I switched the build system to Gradle, and made a custom Gradle file. Beneath defaultConfigs, I added:

  1. signingConfigs {

  2. release {

  3. storeFile file("myreleasekey.keystore")

  4. storePassword "mypassword"

  5. keyAlias "MyReleaseKey"

  6. keyPassword "mypassword"

  7. v2SigningEnabled false

  8. }

  9. }

Gradle complains that it cannot find "v2SigningEnabled". Full error message here.

Has anyone run into this before? How did you sign your app for Oculus?

This topic has been closed for replies.

6 replies

LaurenAuthor
Up and Coming
August 19, 2017
Turns out there is no good way to do it from within Unity. Rather than using Gradle, you can use the regular internal build system then re-sign using jarsigner. 

For more information, refer to the following video: https://www.youtube.com/watch?v=VeCqUPaRYfM&feature=youtu.be
New Participant
August 20, 2017
I preferred to do it the old fashioned way rather than using gradle. By command line I used this command from the android sdk build-tools folder to tell whether it was signed by v1 and/or v2:

apksigner verify -v ./yourbinary.apk

Then using this command it changes the signatures from v2 to v1:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name

The keystore was made in Unity

New Participant
April 5, 2018
Thanks @AdbC99 for his excellent work-around. Just want to add that I had to first remove the META-INF folder from the APK before I could properly resign it with jarsigner, e.g.: zip --delete yourbinary.apk "META-INF/*"
January 18, 2019
https://developer.android.com/about/versions/nougat/android-7.0#apk_signature_v2

Selecting use custom gradle file and making these changes worked for me.
@Lauren I had to toggle the use custom gradle file radio button option, and I just copied the default gradle build file from temp into the custom one, to make the v2SigningEnabled false change.  It seemed to rebuild it's own gradle file and overwrite my changes using the gradle automatically generated build file.  Hope that helps.
New Participant
October 24, 2019
This will pop up if you don't do what @devtiledmedia figured out
ERROR: The APK is signed using Signature Scheme V1, however it was previously signed with V2, and re-signed on top with V1. Such APKs are treated as corrupted, and won't be able to install.
New Participant
December 13, 2019
I tried your way @JacksonGordon but unity keeps creating a build.gradle file and isn't using my custom file. How did you solve that exactly?