cancel
Showing results for 
Search instead for 
Did you mean: 

How to sign Gear VR APK using Signature Scheme V1?

Lauren
Protege
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?

6 REPLIES 6

Lauren
Protege
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

AdbC99
Explorer
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

devtiledmedia
Honored Guest
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/*"

Anonymous
Not applicable
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.

spatialfree
Explorer
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.

mimi_rafiki
Honored Guest
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?