How to sign Gear VR APK using Signature Scheme V1? — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

How to sign Gear VR APK using Signature Scheme V1?

LaurenLauren Posts: 13
NerveGear
edited August 2017 in Unity Development
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:

 signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "mypassword"
keyAlias "MyReleaseKey"
keyPassword "mypassword"
v2SigningEnabled false
}
}

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?

Comments

  • LaurenLauren Posts: 13
    NerveGear
    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: 
  • AdbC99AdbC99 Posts: 6 Oculus Start Member
    edited August 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

  • devtiledmediadevtiledmedia Posts: 1
    NerveGear
    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/*"
  • JacksonGordonJacksonGordon Posts: 138
    Art3mis
    edited January 18
    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.
Sign In or Register to comment.