Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Oculus Quest and Building for Unity

NemoKradNemoKrad Posts: 5
NerveGear
Hi all,

Forgive me if this has been raided before, but I did a search here and on the web and found nothing that would help. 

Bottom line is, I have just got my self a Quest, and love it, but now would like to deploy something of my own to it. I have it set in developer mode, I can see from running adb.exe devices that it is there and accessible. I have updated my Android SDK and in my test Unity project, installed the Oculus samples. I am trying to build and deploy the AvatarGrab scene.

Plug in my Quest, and do a Build and run, first I get this pop up

Now, as I say, I have updated my SDK(s), after getting this error again and again I pretty much installed them all :/

Unity is configured for the right folder too

And I have the project set like this (was told to use 19 as a friend who has released a game for the quest used the same):


So, I continue telling Unity to use the highest it can find, I gets to "checking android devices" and then errors with this:


Can anyone see what I am doing wrong here? I know I must be doing something daft right?

Thanks for taking a look at this, and I hope you can point me in the right direction :)

Comments

  • TsuyoiRaionTsuyoiRaion Posts: 1
    NerveGear
    1) Unity requires a very specific version of android SDK to build to android, even if it prompts you to update to the latest version, DON'T

    2) You don't have the NDK installed and assigned, something you should always do if building to mobile platforms.

    3) Don't use embedded JDK, install it manually and use the appropriate version.

    Versions for each SDK, NDK & JDK for building to android will make the difference if it successfully builds or fails. Something that's not quiet apparent nor indicated by the engine itself and something i spent quiet some time figuring out myself after many trials and errors.

    But once you do the setup 1 time, it should work for any other versions of unity and builds for your games (Y)
  • simondarksidejsimondarksidej Posts: 12
    NerveGear
    One of the best guides I've seen around is this one by the Skarred Ghost
    https://skarredghost.com/2019/06/08/how-get-started-oculus-quest-development-unity/

    Main points to recognise when using any Android device from Unity:
    Hope that helps.
  • NemoKradNemoKrad Posts: 5
    NerveGear
    Hi both, thanks for the responses :)
    • ADB is installed as I can run it and see my device is available. Going to re install off that link.
    • Now I have install a load of Android SDK stuff, how o I know what I should be removing? What is the Unity Android SDK?
    • My device is unlocked, done from the paired app, and confirmed in the device too
    • As I say, I can see it with ADB.


  • NemoKradNemoKrad Posts: 5
    NerveGear
    OK, still have the error when checking for compatible Android devices....
  • lsummerslsummers Posts: 25 Oculus Start Member
    edited June 15
    This is a fun issue I hit last week too.

    #1 - Unity is now requiring an updated version of Android SDK Tools.  Unfortunately, this isn't compatible with what most of us have installed (the stand alone GUI android SDK).  That was deprecated by Google.  There are work arounds, but the lazy fix is to uninstall, and reinstall, by installing the full Android Studio (which is now the only way to access the Android SDK GUI).  After that, it still won't work fully however, as Unity has its Build script using the new Android SDK Tools 26.x. but Build and Run is using Android SDK Tools 25.x.  Smart move by Unity :P. Means if you continue on that path you will need to manually install the APKs.

    #2 - try doing a "Build" only, and manually installing the APK using ADB. 

    From there, you could probably fix the Unity built script to install the APK properly.  Or just manually install the APK each time you do a build. 

    Ugly, I know, and more importantly this likely could break other versions of Unity you have installed on their build methods.  But yeah its a known Unity issue that the Unity team may, or may never, get around to fixing.
  • NemoKradNemoKrad Posts: 5
    NerveGear
    I installed the latest build of Unity, and it deploys now. But  my apps run, then just close, so still have an issue, but deploying now at least :)
  • NemoKradNemoKrad Posts: 5
    NerveGear
    OK, so, one step forward, I am now deploying to my Quest, but when I run my app it just bombs back out So, installed Android logcat for Unity, and when I try to run my app I get this set of errors:-

    0001/01/01 00:00:00.000 -1 -1 Info : --------- beginning of main
    2019/06/26 17:23:25.208 1123 1182 Info PackageManager.DexOptimizer: Running dexopt (dex2oat) on: /data/app/vmdl1457157710.tmp/base.apk pkg=com.BlackSunSolutionsLtd.Auditoribus isa=arm vmSafeMode=false debuggable=true target-filter=interpret-only oatDir = /data/app/vmdl1457157710.tmp/oat sharedLibraries=null
    0001/01/01 00:00:00.000 -1 -1 Info : --------- beginning of system
    2019/06/26 17:23:25.395 1123 1154 Info ActivityManager: Force stopping com.BlackSunSolutionsLtd.Auditoribus appid=10070 user=-1: installPackageLI
    2019/06/26 17:23:25.475 1123 1182 Info PackageManager: Package com.BlackSunSolutionsLtd.Auditoribus codePath changed from /data/app/com.BlackSunSolutionsLtd.Auditoribus-1 to /data/app/com.BlackSunSolutionsLtd.Auditoribus-2; Retaining data and using new
    2019/06/26 17:23:25.475 1123 1182 Warn PackageManager: Code path for com.BlackSunSolutionsLtd.Auditoribus changing from /data/app/com.BlackSunSolutionsLtd.Auditoribus-1 to /data/app/com.BlackSunSolutionsLtd.Auditoribus-2
    2019/06/26 17:23:25.475 1123 1182 Warn PackageManager: Resource path for com.BlackSunSolutionsLtd.Auditoribus changing from /data/app/com.BlackSunSolutionsLtd.Auditoribus-1 to /data/app/com.BlackSunSolutionsLtd.Auditoribus-2
    2019/06/26 17:23:25.724 1123 1182 Info ActivityManager: Force stopping com.BlackSunSolutionsLtd.Auditoribus appid=10070 user=0: pkg removed
    2019/06/26 17:23:25.856 1977 2005 Warn LibraryProvider: Cannot find entitlement for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:25.856 1777 1777 Warn OCMSLibrary: null cursor received for query content://com.oculus.ocms.library/apps/com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:25.864 1977 1977 Warn LibraryProvider: Cannot find entitlement for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:25.864 1977 1977 Warn OCMSLibrary: null cursor received for query content://com.oculus.ocms.library/apps/com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:26.602 1123 1498 Info ActivityManager: Force stopping com.BlackSunSolutionsLtd.Auditoribus appid=10070 user=0: from pid 9669
    2019/06/26 17:23:26.855 1123 1515 Debug NonVrActivityIntentWrapper: Is Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity }, a valid launch intent: true
    2019/06/26 17:23:26.855 1123 1515 Debug OculusGoPackageTypeHelper: Is package com.BlackSunSolutionsLtd.Auditoribus a system app: false
    2019/06/26 17:23:26.855 1123 1515 Debug OculusGoPackageTypeHelper: Is package com.BlackSunSolutionsLtd.Auditoribus Oculus store app: false
    2019/06/26 17:23:26.855 1123 1515 Debug OculusGoPackageTypeHelper: Is com.BlackSunSolutionsLtd.Auditoribus, a side loaded Vr app: true
    2019/06/26 17:23:26.855 1123 1515 Debug NonVrActivityIntentWrapper: Package com.BlackSunSolutionsLtd.Auditoribus type: 2
    2019/06/26 17:23:26.856 1123 1515 Info ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity} from uid 2000 on display 0
    2019/06/26 17:23:27.048 1123 1142 Info ActivityManager: Start proc 9679:com.BlackSunSolutionsLtd.Auditoribus/u0a70 for activity com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity
    2019/06/26 17:23:27.161 1303 1303 Warn asset: Asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk is neither a directory nor file (type=1).
    2019/06/26 17:23:27.162 1303 1303 Error ResourcesManager: failed to add asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk
    2019/06/26 17:23:27.162 1303 1303 Warn PackageManager: Failure retrieving resources for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.163 1303 1303 Warn asset: Asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk is neither a directory nor file (type=1).
    2019/06/26 17:23:27.163 1303 1303 Error ResourcesManager: failed to add asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk
    2019/06/26 17:23:27.163 1303 1303 Warn PackageManager: Failure retrieving resources for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.164 1303 1303 Warn asset: Asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk is neither a directory nor file (type=1).
    2019/06/26 17:23:27.164 1303 1303 Error ResourcesManager: failed to add asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk
    2019/06/26 17:23:27.164 1303 1303 Warn PackageManager: Failure retrieving resources for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.164 1303 1303 Warn asset: Asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk is neither a directory nor file (type=1).
    2019/06/26 17:23:27.164 1303 1303 Error ResourcesManager: failed to add asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk
    2019/06/26 17:23:27.165 1303 1303 Warn PackageManager: Failure retrieving resources for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.165 1303 1303 Warn asset: Asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk is neither a directory nor file (type=1).
    2019/06/26 17:23:27.165 1303 1303 Error ResourcesManager: failed to add asset path /data/app/com.BlackSunSolutionsLtd.Auditoribus-1/base.apk
    2019/06/26 17:23:27.165 1303 1303 Warn PackageManager: Failure retrieving resources for com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.307 1123 1177 Info ActivityManager: Displayed com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity: +276ms
    2019/06/26 17:23:27.318 9679 9694 Debug Unity: [VFS] Mount /data/app/com.BlackSunSolutionsLtd.Auditoribus-2/base.apk
    2019/06/26 17:23:27.329 9679 9694 Info Unity: ApplicationInfo com.BlackSunSolutionsLtd.Auditoribus version 0.1 build 00fa0722-8b41-44f9-b023-981592554f0e
    2019/06/26 17:23:27.421 9679 9694 Debug Unity: PlayerConnection initialized from /data/app/com.BlackSunSolutionsLtd.Auditoribus-2/base.apk/assets/bin/Data (debug = 0)
    2019/06/26 17:23:27.421 9679 9694 Debug Unity: PlayerConnection initialized unix socket : Unity-com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.457 9679 9694 Debug vulkan: searching for layers in '/data/app/com.BlackSunSolutionsLtd.Auditoribus-2/lib/arm'
    2019/06/26 17:23:27.457 9679 9694 Debug vulkan: searching for layers in '/data/app/com.BlackSunSolutionsLtd.Auditoribus-2/base.apk!/lib/armeabi-v7a'
    2019/06/26 17:23:27.536 2060 4200 Info ClientMgr: ClientMgr::CreateClient: 9679:com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.537 2060 4200 Info SharedMemoryServer: SharedMemoryServer::MapMemory: Allocated shared memory fd 43 (VrRuntimeService_PrivateReadWrite_com.BlackSunSolutionsLtd.Auditoribus)
    2019/06/26 17:23:27.538 2060 4200 Info GuardianSystem: SetCurrentPackageName: com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.578 2060 4200 Debug VrRuntimeService: VrRuntimeService: destroyClientInternal: com.BlackSunSolutionsLtd.Auditoribus, pid: 9679
    2019/06/26 17:23:27.579 2060 4200 Info ClientMgr: ClientMgr::DestroyClient: 9679:com.BlackSunSolutionsLtd.Auditoribus
    2019/06/26 17:23:27.609 1123 1197 Warn InputDispatcher: channel '50e07da com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
    2019/06/26 17:23:27.609 1123 1197 Error InputDispatcher: channel '50e07da com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    2019/06/26 17:23:27.610 1123 1142 Info WindowManager: WIN DEATH: Window{50e07da u0 com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity}
    2019/06/26 17:23:27.610 1123 1142 Warn InputDispatcher: Attempted to unregister already unregistered input channel '50e07da com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity (server)'
    2019/06/26 17:23:27.610 1123 1494 Info ActivityManager: Process com.BlackSunSolutionsLtd.Auditoribus (pid 9679) has died
    2019/06/26 17:23:27.610 1123 1142 Warn WindowManager: Force-removing child win Window{56e1b39 u0 SurfaceView - com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity} from container Window{50e07da u0 com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity}
    2019/06/26 17:23:27.611 1123 1494 Warn ActivityManager: Force removing ActivityRecord{848b0f7 u0 com.BlackSunSolutionsLtd.Auditoribus/com.unity3d.player.UnityPlayerActivity t69}: app died, no saved state
    

    I have no idea what is causing this. If I switch off XR in Unity, I can deploy and run my app on the Quest, but, as you can imagine, it just runs in a window.... At the moment, my app is just an empty scene by the way :D but the same thing happens with the Oculus scene's from the asset store too :(
  • simondarksidejsimondarksidej Posts: 12
    NerveGear
    One of the best guides I've seen around is this one by the Skarred Ghost
    https://skarredghost.com/2019/06/08/how-get-started-oculus-quest-development-unity/

    Main points to recognise when using any Android device from Unity:
    • Check you have ADB drivers installed (in this case, the Oculus version - https://developer.oculus.com/downloads/package/oculus-go-adb-drivers/)
    • Only use the Android SDK / NDK provided by Unity.  Expand the Android platform when installing to select the tools (as @TsuyoiRaion points out, Unity is picky)
    • Check you have unlocked developer mode from the oculus app for the device
    • Check you can see the device from the ADB command prompt "adb devices
Sign In or Register to comment.