setting up android for VR: this is so stupid stupid stupid stupid stupid

Hi guys.

I’m trying to set up a project. How… HOW???

I want to set it up for the oculuc quest. So I got android studio. However, I couldn’t install it on my C drive because I need to save space on there. So I did it on my D drive.

I then installed the version 25 SDK or whatever(nougat) to use in unreal engine. I also installed it to D because it was warning me that C might not have enough space.

But now, the setupandroid.bat file can’t locate it. Yes, I restarted. Why is this so complicated? Please please help because I’ve been clicking links and doing things for 3 hours now trying to do this.

Help is greatly appreciated.

Open the setupandroid.bat file, you might need to set the correct location in the file before running it. Check out GameDevXR on youtube, he has several videos about setting up for deployment on Oculus Quest via android.

There were a few YouTube videos that helped me accomplish this for the first time a few weeks ago (and I am totally new at this, going through the Unreal Oculus tutorial, which was a little too advanced for me on this part). None of that was at all easy for n00b me, so I’ll pass along my notes and hope it won’t take you as long as it took me.

I’d recommend this particular video to start:

then this boilerplate project helped me as proof of concept that I could get something onto the Quest 2:

And if you get to the point where you want to know about PSO Caching, this is relevant (even though not specifically about Quest) in addition to the official section from the Unreal Oculus tutorial:

Additional learnings:

  • only use Android version 3.5.3
  • if you run the setupandoid.bat, it should have set your computers environmental variables for the SDK, NDK and java, and no need to set those paths in Unreal Project Settings (leave blank)
  • if you ever need to uninstall/reinstall Android Studio, read this including the comments
    How to completely uninstall Android Studio from windows(v10)? - Stack Overflow
  • If you need to relaunch your project, close project, delete Saved and Intermediate folders, and reopen
  • if you get a black screen, debug your project settings against the ones in the boilerplate project
  • When launching, if your project seems to take forever at “Launching On”, try putting on the headset and that may awaken it and complete the build.
  • Should you launch a custom profile for PSO caching purposes you must be sure to set the tick in Deploy.
1 Like

thank you, I’ll check this out tomorrow. How do I tell the setupandriod.bat file where I put the android sdk though?(I installed it on the non-default drive)

Glad to know that our Oculus Quest Starter help you go through the setup. Keep going!

1 Like

I’m not sure you can… The idea of that .bat file is, I think, to save the user from having to manage the separate Java and SDK installs that, prior to 4.25, one had needed to put into UE project settings.

My memory is hazy (the first video was certainly successful for me on this point), I can’t recall the specifics of setting up Android Studio vs. the UE androidsetup.bat that came with it, but I think the Android Studio install might have prompted you to where you want the SDK. I don’t know if it has to be in AppData, but my guess is that once you download the SDK that’s just where it goes, along with other dependencies like gradle and such:

To me, the question would be does the Android Studio 3.5.3 install let you put the SDK on D:, and if so does running androidsetup.bat find it. If not, I would experiment with temporarily making room on C: and letting it set it up the way it wants to, then once you see it succeed, try copying those directories onto D:, remapping your environmental variables, and delete the originals off of C.

I will tell you, this took a lot of un installing and re-installing of Android Studio for me, which is why I include the links on how to do a full uninstall of Android Studio, and there is information in those comments I had also needed to do in order to get a clean uninstall.

Update: Check this out

I’m trying to learn more about standalone packaging today, and at 5:19 it shows that is possible to edit that AndroidSetUp.bat, fwiw

1 Like

@SwenYan It was awesome! Thank you so much for that!

thank you for this. I got the setupandroid to run, but the window just closes out. Am I supposed to get an NDK or whatever? Or is this a more modern version that already has the NDK included and now all I have to do is set up unreal engine? Thanks.

Correct, the latter. Once it’s run, if you now check your Environmental Variables (like in picture above) it should say that it has put that ndk into AppData\Local\Android\Sdk

Type %AppData% into your windows explorer address bar and hit enter to actually look at the files. But yes, it should be all set up now.

well, I actually put the sdk in documents like the video did, but it shouldn’t make a difference.

Anyway, you have been so helpful. Assuming everything is set up now, what do I do now to ensure it’ll run on VR?

(additional question; how do I simulate the project in VR? I saw the option for “simulate in VR” under the play button, but it was grayed out, even when I hooked up my quest. Will it work now that I set up the android thing, or do I need to turn on a plugin, or let unreal detect the quest, or what? Thanks again.)

1 Like

Bearing in mind I’m still far from expert, and there’s going to be many more possible points of glitches, there are AFAIK three different levels of experiencing your project on your headset , in order of ease:

  1. Using OculusLink. This is the easiest and explained early on in the Unreal Learning Path course “Oculus VR Production for unreal Engine”, where you plug in and play a level just by hitting “VR Preview” from Unreal, and then putting on your headset, and accessing OculusLink.

  2. Launching it. I take it this is basically what is meant by ‘sideloading’, is to “Launch” the Unreal project from Unreal to your connected Quest 2 device, meaning that it actually builds it there so you don’t always need to be connected by OculusLink. And this is what the tutorial just expects you to know how to do, but is not actually that straightforward. Those are the videos and links I mentioned above, and it took me awhile to learn how to do. If you are set up correctly, and it sounds like you are, you should be able to at least launch that Oculus Quest Starter Boilerplate project, which has all the right project settings set so that you can see it is possible. Then, depending on what your actual project is, you’ll want to experiment and see if you can get that built as well. Then, and this is not IMO an undertaking to take lightly for a beginner (it wasn’t for me), but there is a technique called PSO Caching described both in that Unreal tutorial and somewhat better described in the video I linked, that you need to learn at some point if you want to create a project that has shorter load times should you use a lot of materials.

  3. Finally there is Packaging, where you’re generating the APK build to be able to share. And again, with that Oculus boiler plate project, this is relatively simple and works well and this is about where I’m at, but it’s really not that easy. Should you, as I am, be working with your own project attempting to replicate the sample Darts project from the Epic vault, it will throw many errors that have to do with various bugs in the project that Unreal provides, you have to learn the intricacies of what building an APK file entails, but you should be a little grounded if you are able to Launch. Currently, I’m better at packaging for Rift App than Quest App, and have used a built in tool to upload a Rift build to my Oculus Dev Dashboard, and now I’m tring to learn about Quest App lab, not covered in the tutorial, and why my Entitlement Check works for my Rift ID but not my Quest ID.

Anyway, then I’ll need to learn about optimization tools and MRC and stuff, but hopefully this gives you a little bit of an overview of what happens next.

Oh, and to answr more specifically what you’re asking. I think you

  1. plug in your headset and make sure the desktop Oculus app is detecting and connected via Oculus link.
  2. Put on the headset and make sure to accept the connection to your computer is safe
  3. then start Unreal, the button should not be greyed out.
  4. Once you hit VR Preview, put the headset on and go to Oculus Link if you are not. And at that point you’ll hopefully see it playing.

you, my man , are a freaking legend. IT’S FINALLY WORKING!
The one problem is that the FPS is really, really bad as a result of me only having a usb2 cable(I actually do have a usb3 but oculus said it wouldn’t work either).
Again, thanks man.

1 Like