cancel
Showing results for 
Search instead for 
Did you mean: 

Difficulty compiling samples

EddieEdwards
Honored Guest
As a bit of an Android n00b I've been having some problems compiling the samples which I have not much idea how to fix.  I've followed the documentation step by step (I think).

First, gradle sync does not work, following the documentation for compiling the samples.  It says to get the latest gradle version, which is 5.1.1 and does not have "leftShift" function for "<<" operator.  It seems doLast {} is needed instead and I've had some success both with forcing gradle 4.10 and with modifying the gradle files to work with 5.1.1.  So far so good ...

... except gradle sync never finished.  It just spins doing nothing after a while.  At this point Android Studio thinks there's a project and I can build it and it compiles code and stuff.  However, there is no Configuration in the dropdown.  It just says "Add Configuration".  The docs expect there to be an Android configuration here but none appears.  "Add Configuration" seems to be unhelpful too - there is no Module in the Module dropdown for Android App, and looking at some images online it seems Android Native App should be an option in Templates, but it does not appear.  However, NDK is definitely ticked and installed, and the ANDROID_NDK_HOME points to the right place.

Does anyone have any clues where I'm going wrong here?
4 REPLIES 4

EddieEdwards
Honored Guest
Well isn't that always the way.  I think the problem is that I installed Android Studio for the first time ever yesterday.  This version has an experimental feature "Sync Only Active Variant" which seems to be enabled by default.  If you go to File->Settings->Experimental and untick this box, then reopen the project, and resync gradle, it seems to work.  I now have the Android Configuration as expected.

sinoth
Honored Guest
How on earth did you figure this out? Thank you so much -- it solves being able to compile any VR sample on Windows. For those curious, the error is something along the lines of:
Gradle sync failed: Illegal char <:> at index 28: G:/ovr_sdk_mobile_1.29.0-2/G:-VrHands.iml (12 s 250 ms)
Unchecking the "Sync Only Active Variant" experimental feature in Android Studio resolves this.

AmmarkoV
Explorer
Trying to compile *any* VRsample on Windows 10 / Android Studio 4.1.1 and failing horribly, even using the build.bat scripts fail with compilation errors , I have done the experimental sync only active variant unticking.. 

What an SDK 😛

------------------------------------------------------------
Gradle 5.6.4
------------------------------------------------------------

Build time:   2019-11-01 20:42:00 UTC
Revision:     dd870424f9bd8e195d614dc14bb140f43c22da98

Kotlin:       1.3.41
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM:          1.8.0_242-release (JetBrains s.r.o 25.242-b01)
OS:           Windows 10 10.0 amd64

Gradle took 1.762574 seconds
ANDROID_NDK_HOME: C:\Users\ammar\AppData\Local\Android\Sdk\ndk\21.2.6472646


building in .
C:\OculusMobileSDK\bin\scripts\build\../../../gradlew assembleRelease --daemon -quiet --build-cache --configure-on-demand --parallel -Pshould_install
C:\OculusMobileSDK\bin\scripts\build\../../../gradlew assembleRelease --daemon -quiet --build-cache --configure-on-demand --parallel -Pshould_install

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':VrSamples:VrCubeWorld_Framework:Projects:Android:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process C:\Users\ammar\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\OculusMobileSDK\VrSamples\VrCubeWorld_Framework\Projects\Android\jni\Android.mk NDK_APPLICATION_MK=C:\OculusMobileSDK\VrSamples\VrCubeWorld_Framework\Projects\Android\jni\Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=0 APP_PLATFORM=android-24 NDK_OUT=C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\OculusMobileSDK\VrSamples\VrCubeWorld_Framework\Projects\Android\build\intermediates\ndkBuild\release\lib V=0 -j6 -CC:\OculusMobileSDK\VrSamples\VrCubeWorld_Framework\Projects\Android APP_PLATFORM=android-24 NDK_TOOLCHAIN_VERSION=clang APP_STL=c++_static NDK_DEBUG=0 OVR_DEBUG=0 USE_ASAN=0 vrcubeworldfw}
  make: Entering directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  [arm64-v8a] Compile++      : sampleframework <= Fader.cpp
  make: Leaving directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  make: Entering directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  [arm64-v8a] Compile++      : sampleframework <= AnimComponents.cpp
  make: Leaving directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  make: Entering directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  [arm64-v8a] Compile++      : sampleframework <= ActionComponents.cpp
  make: Leaving directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  make: Entering directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  [arm64-v8a] Compile++      : sampleframework <= DefaultComponent.cpp
  make: Leaving directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  make: Entering directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  [arm64-v8a] Compile++      : vrcubeworldfw <= VrCubeWorld_Framework.cpp
  make: Leaving directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  make: Entering directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'
  [arm64-v8a] Compile++      : sampleframework <= GuiSys.cpp
  make: Leaving directory 'C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android'

  fcntl(): Bad file descriptor
  C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android/jni/../../../../../VrSamples/SampleFramework/Projects/Android/jni/../../../Src/GUI/Fader.cpp:39:9: error: use of undeclared identifier 'assert'
          assert(fabs(fadeDelta) > MATH_FLOAT_SMALLEST_NON_DENORMAL);
          ^
  C:/OculusMobileSDK/VrSamples/VrCubeWorld_Framework/Projects/Android/jni/../../../../../VrSamples/SampleFramework/Projects/Android/jni/../../../Src/GUI/Fader.cpp:125:13: error: use of undeclared identifier 'assert'
              assert(false); // this should never be called with state FADE_PAUSE         

etc.

Sqee
Honored Guest
If it helps, I had the same issues and by trial and error managed to find the needed setup to get rid off the assert errors for me:
Mobile SDKVersion 1.37 goes with NDK 17.2.
Go to your SDK tools, press "Show package details" and uninstall whichever NDK you have and install Version 17.2.