Quest APK v2 signature

I’m having so much trouble… days of spinning without success so far and I feel like I’m going crazy.

I have a successful APK build. I generated a keystore and used it to get the APK built (it wouldn’t build for distribution without it)… But my apk isn’t signed and Oculus won’t accept unsigned apks. I can manually sign it using jarsigner but that’s only for v1 signatures. I need a v2 signature. I have NO idea how to get Android Studio to sign my packaged APK v2.

  • I open it up in Android Studio “profile/debug apk”
  • Build / Generate Signed Bundle or APK
  • APK
  • Module is the apk I opened, keystore path is the same keystore i used to build apk (path to UE project Build/Android/Keystore.jks)
    - the next page has NO settings for V1, V2 at the bottom

When I proceed from here I get this error:

Error:Internal error: (java.lang.ClassNotFoundException)$Index
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at com.intellij.util.indexing.counters.IndexCounters.<clinit>(
at com.intellij.util.indexing.impl.MapReduceIndex.<init>(
at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.<init>(
at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.<init>(
at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.<init>(
at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(
at org.jetbrains.jps.cmdline.BuildSession.runBuild(
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(
at java.util.concurrent.Executors$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

Any help would be greatly appreciated.

UPDATE! here’s how I got it to work:

I don’t know if this is documented anywhere but I couldn’t find it and would have appreciated knowing this 2 days ago.

1- Rather than the version of Android Studio recommend in the unreal documentation (3.5.3) I downloaded the latest version (4.1.2)
2 - the Oculus documentation ( just says “In Android Studio, go to Build > Generate Signed Bundle / APK.” This isn’t clear enough. I had to open Android studio and open>[Unreal Project]>Intermediate>arm64>gradle
3 - when open (mine wouldn’t open in ASv3.5.3), then Build > Generate Signed Bundle / APK
4 - the generated/signed apk was saved in gradle>app>app-release.apk
5 - When I only selected v2 signature Oculus didn’t accept the apk as signed, even though the above docs say selecting just v2 is fine. I had to select both v1 and v2 to get a build that the site accepted.

I hope that helps someone else save some time.