cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble building samples for Mobile SDK v1.0.0 (fixed!)

mduffor
Protege
I'm trying to build the Mobile SDK v1.0.0's version of VrCubeWorld_NativeActivity under Linux (Ubuntu) with the command line tools, and have run into a bit of difficulty. The command line tools ran fine for SDK v0.6.2.0, but now that things are using Gradle there's some secret sauce I'm missing.

What I have so far:

Most of the text files in the SDK have DOS line endings, and need to be converted. Also, the scripts that come out of the zip file don't have execute permissions. Let's assume that ovr_sdk_mobile_1.0.0.0.zip is installed into ~/android/ovr_sdk_mobile, and the proper level of tools are installed (Andriod API 19, Build Tools v22.0.1). That gets us something like the following.

cd ~/android/ovr_sdk_mobile/VrSamples/Native/VrCubeWorld_NativeActivity/Projects/Android
chmod ug+x ./build.py
chmod ug+x ../../../../../gradlew

dos2unix build.py
dos2unix build.gradle
dos2unix settings.gradle
dos2unix AndroidManifest.xml
dos2unix jni/Android.mk
dos2unix jni/Application.mk
dos2unix ../../../../../gradlew
dos2unix ../../../../../gradle/wrapper/gradle-wrapper.properties
dos2unix ../../../../../settings.gradle
dos2unix ../../../../../build.gradle
dos2unix ../../../../../bin/scripts/build/ovrbuild.py
dos2unix ../../../../../cflags.mk

cp ~/Downloads/oculussig_whatever ../../assets/ <-- this is the signature file downloaded from the Oculus Dev site.

./build.py

This gets us most of the way there. All of the libraries build properly, but when the project itself tries to build we get the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'assembleRelease' not found in root project 'VrCubeWorld_NativeActivity'.


This is from line 265 in bin/scripts/build/ovrbuild.py, where gradle is called with the "assembleRelease" directive. Alas, since build.gradle doesn't have a release buildType, we get the failure.


So what in the configuration is missing? Are the files in the SDK incomplete? Are there build instructions where something more than ./build.py needs to be run? Any suggestions?

Thanks for any and all help.

Cheers,
mduffor
21 REPLIES 21

mduffor
Protege
Slight correction on the above:

Alas, since build.gradle doesn't have a release buildType, we get the failure.


Apparently the issue is that the build.gradle file for the VRSamples/Native/* apps lack both a "task assembleDebug" and a "task assembleRelease", which is why ovrbuild.py can't find the correct gradlew command to run. Has this build path ever worked correctly internally at Oculus?

Thanks for any help,
mduffor

guerk
Honored Guest
similar problems on mac os with mobile sdk 1.0.0

the scripts have to be converted to unix line endings with dos2unix

then build.py is able to build the apk.

one needs to install the apk in build/outputs/apk/ with the command line adb install -r ....

because the script build.py is breaking before installing with

gradle --daemon -q printProjectName
Traceback (most recent call last):
File "./build.py", line 29, in <module>
ovrbuild.build()
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 492, in build
checksig( device )
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 603, in checksig
apkpath = get_apk_path()
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 596, in get_apk_path
'app_name': get_project_name(),
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 570, in get_project_name
( retcode, out, err ) = call( cmd, suppressErrors=True, grabStdOut=True)
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 133, in call
p = Popen( cmdline.encode("ascii","ignore").split(), stdout=PIPE, stderr=PIPE, shell=useShell )
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

mduffor
Protege
Does anyone from Oculus actually read these forums to provide any real technical support? Is there another channel to use in order to report when something in the SDK is broken? Has the Native app pathway been abandoned in favor of only supporting Unity developers?

The VrTemplate project doesn't fare any better than VrCubeWorld_NativeActivity or VrCubeWorld_Framework.

Part of the problem stems from the build system trying to build everything and everything at once. You can't just build VrCubeWorld_NativeActivity, you have to also build libvrcapture, libovr, vrapi_impl, vrapi_loader, vrappframework, systemutils, vrgui, vrlocale, vrmodel, and vrsound every single time as well. In trying to support building across so many directories, you have to support multiple build.gradle and settings.gradle files, and a lot of relative paths 4-5 levels deep. Therefore if you want to build your own project in a directory structure other than the VrSamples heirarchy, you are almost starting from scratch.

Has anyone at Oculus built the most recent SDK native samples under Mac or Linux? There doesn't appear to be any documentation on how to do it, and from what I can tell it is currently broken.

Thanks for any response.
mduffor

cybereality
Grand Champion
Sorry for the delay. I was out of office travelling all last week for the holidays.

Let me see if anyone here has a solution for you.
AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV

mduffor
Protege
Thanks for the response, cybereality. I see you on these forums responding (and I appreciate it!), but it would probably be helpful if more of the Oculus employees were on here, especially those in a tech support capacity. 🙂

I finally found the error, after wasting days looking for it. The problem is that Oculus is only testing on Windows and Mac, not Linux. Windows and Mac follow the ridiculous practice of having case insensitive file systems.

In this case, the file VrSamples/Native/VrCubeWorld_NativeActivity/Projects/Android/settings.gradle has a capitalization error in line 4, the "include" command. Instead of 'VrSamples:Native:VrCubeworld_NativeActivity:Projects:Android' it needs to be 'VrSamples:Native:VrCubeWorld_NativeActivity:Projects:Android' with the "World" in "VrCubeWorld" capitalized properly.

I also noticed that VrGUI is sometimes misspelled as "VrGui" in several of the Android.mk files.

The Gradle developers deserve a punch in the nuts for silently failing when include paths can't be found. Grrrrr....

Now I can finally get back to actual development. At least I know a lot more now about the Gradle build system.

Cheers,
mduffor

mduffor
Protege
"guerk" wrote:
similar problems on mac os with mobile sdk 1.0.0

...
because the script build.py is breaking before installing with

...
gradle --daemon -q printProjectName
Traceback (most recent call last):
File "./build.py", line 29, in <module>
ovrbuild.build()
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 492, in build
checksig( device )
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 603, in checksig
apkpath = get_apk_path()
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 596, in get_apk_path
'app_name': get_project_name(),
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 570, in get_project_name
( retcode, out, err ) = call( cmd, suppressErrors=True, grabStdOut=True)
File "/Users/guerk/Oculus/ovr_sdk_mobile_1.0.0.0/bin/scripts/build/ovrbuild.py", line 133, in call
p = Popen( cmdline.encode("ascii","ignore").split(), stdout=PIPE, stderr=PIPE, shell=useShell )
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory


This error occurs when you haven't run dos2unix on gradlew yet.

doles
Protege
Sorry for late reply.

I just setup a clean Ubuntu machine and downloading latest Android SDK, NDK plus the 1.0 Oculus SDK. Here are the steps for making CubeWorld build from start to finish... this is basically a dump of my history, and a bit verbose.

We will make sure the line endings are fixed in the next SDK release, so hopefully that won't be needed down the line. But it sounds like one step we need to document is adding executable permissions to gradlew. Another issue that wasn't obvious is needing lib32z1 when on 64-bit linux... without it Gradle will just hang without printing errors due to aapt failing.


sudo apt-get update
sudo apt-get install default-jdk
sudo apt-get install lib32z1

mkdir ~/android
cd ~/android

mv ../Downloads/android-ndk-r10e-linux-x86_64.bin .
chmod +x android-ndk-r10e-linux-x86_64.bin
./android-ndk-r10e-linux-x86_64.bin

mv ../Downloads/android-sdk_r24.4.1-linux.tgz .
tar -xzf android-sdk_r24.4.1-linux.tgz
./android-sdk-linux/tools/android

export ANDROID_SDK=~/android/android-sdk-linux
export ANDROID_NDK=~/android/android-ndk-r10e
export ANDROID_HOME=$ANDROID_SDK
export NDKROOT=$ANDROID_NDK
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK

unzip ovr_sdk_mobile_1.0.0.0.zip

find . -name "*.py" -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;
find . -name "*.sh" -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;
find . -name "gradlew" -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;

chmod +x gradlew
chmod +x VrSamples/Native/VrCubeWorld_SurfaceView/Projects/Android/build.py

VrSamples/Native/VrCubeWorld_SurfaceView/Projects/Android/build.py

doles
Protege
I should also note for Mac users specifically... these commands will fix the line endings in every file under your current working directory without needing any other dependencies (e.g. dos2unix).


find . -name "*.py" -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;
find . -name "*.sh" -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;
find . -name "gradlew" -exec perl -pi -e 's/\r\n|\n|\r/\n/g' {} \;

mduffor
Protege
Thanks for the reply and info doles. It would be brilliant if you could get these build steps to the docs team so they could update the Mobile SDK docs on the website.

Cheers!
mduffor