Build error in oculus native mobile sdk version 1.9.0
I was having the exact same problem. Same output and everything.
After tracing the issue down for hours, I finally found my problem to be that my PATH did not include the java bin directory. The error was being caused because the keytool.exe program could not be reached.
On Windows 10, right click on This PC, select Advanced System Settings, select Environment Variables. In the System variables window on the lower half of the screen, find the Path variable. Ensure the java bin directory is in the list.
In my case I had to add:
C:\Program Files\Java\jdk1.8.0_112\bin
The problem was not immediately corrected. I still had Android Studio open. I shut down the program and restarted the computer. After reboot and opening Android Studio again, everything started to build!
Hope this helps somebody else.
I am trying to develop a native gear VR application in android studio using oculus native mobile SDK version 1.9.0. On running the VR samples enclosed within the SDK, I ran into the error mentioned below and the build failed. 

Traceback (most recent call last):
File "C:\ovr_sdk_mobile_1.9.0\bin\scripts\build\ovrbuild_keystore.py", line 86, in 
      genDebugKeystore()
File "C:\ovr_sdk_mobile_1.9.0\bin\scripts\build\ovrbuild_keystore.py", line 84, in genDebugKeystore
      debug_props['storepass'], debug_props['keypass'], replace=False)
File "C:\ovr_sdk_mobile_1.9.0\bin\scripts\build\ovrbuild_keystore.py", line 71, in create_keystore
      return execfn(cmd)
File "C:\ovr_sdk_mobile_1.9.0\bin\scripts\build\ovrbuild_keystore.py", line 82, in 
      create_keystore(lambda x: ovrbuild.call(x),
File "ovrbuild.py", line 169, in call
      gradleTask = "clean" if command_options.should_clean else "assembleDebug" if command_options.is_debug_build else "assembleRelease"
  NameError: global name 'command_options' is not defined
:VrSamples:Native:VrTemplate:Projects:Android:genDebugKeystore FAILED
FAILURE: Build failed with an exception.
*Where:
  Script 'C:\ovr_sdk_mobile_1.9.0\VrApp.gradle' line: 314
*What went wrong:
  Execution failed for task ':VrSamples:Native:VrTemplate:Projects:Android:genDebugKeystore'.
  Process 'command 'C:\ovr_sdk_mobile_1.9.0/bin/scripts/build/ovrbuild_keystore.py.bat'' finished with non-zero exit value 1

Could anyone of you help me to solve this error?
This error is also present in oculus SDK version 1.7.0.