Android setup with recent Unity & libraries


#1

Do you have any tips for getting the current example project and SDK to successfully build for Android with current releases of Unity? I’ve been struggling to get them to build for the past few days, but it seems like everything I hack and slash to make Unity stop complaining about one problem just snowballs into more problems.

Confession: I have a few months of experience with Android VR/AR… but all of it involves recent versions of Unity released after the point where it moved “XR” settings to their own category, and after Unity came with support for Cardboard, Daydream, and ARCore already baked-in (I’ve used Unity itself since 5.5, but never for VR/AR). I still struggle when it comes to getting code and examples written before that point to build and run with the current version (2018.2.12f1, as of today).

  • My attempts to build the example Unity app for Android have been completely roadblocked by the Gradle error about colliding attributes: “The attribute meta-data#com.google.ar.core@value=required in :VuforiaWrapper: collides with another value (see the console for details)”. I can elaborate, but I suspect you’re already painfully aware of it.

For the SDK itself, I’m not really sure what settings the Aryzon SDK expects/needs to have in Player Settings -> Android -> XR:

  • Virtual Reality SDK… I can choose Cardboard, Daydream, Mock HMD, None, Oculus, and Vuforia. I’m not sure which one(s) are allowed (or required) by Aryzon’s SDK, nor how the ones that ARE supported should be configured.

  • ARCore supported… checked or unchecked?

  • Vuforia Augmented Reality Support… checked or unchecked? According to Unity, both can’t be checked, and there’s an entire procedure for configuring Vuforia to use ARCore listed on Vuforia’s site that I’m not sure whether is necessary, unsupported, or irrelevant.

Thanks!


#2

Vuforia and ARCore are a pain to work with. We have been able to get it to work.

If you have issues with the sample project my advise is to start with a new Unity project instead and only start with ARCore or Vuforia, not both. Then add the Aryzon SDK and see our tutorial series how to set it up.

If you want both in the same scene then you should take care of a couple of things. These settings work for us:

  • You can and should check both the Vuforia and ARCore supported checkboxes, although Unity says not to.
  • In the ARCore settings we have set ARCore Required to false, since we add a check for phones which don’t support ARCore and use Vuforia instead.
  • We manually activate the Vuforia GameObject and manually initialise Vuforia if ARCore is not supported (set delayed initialisation in the Vuforia configuration).
  • ARCore adds a SkipPermissionsDialog to the AndroidManifest. You must duplicate the AndroidManifest Unity creates when building and add it to Plugins/Android/ but set this setting to false. Else Vuforia will not function. You may also ask for permissions manually before Vuforia initialises.
  • Building from within Unity with Gradle works for us, maybe internal works as well, haven’t tried.

The SkipPermissionsDialog thing took us a few days to figure out but only after debugging everything in logcat instead of just the Unity logs.

We are on the same Unity version as you are so it should work. Hope this helps!


#3

Thanks! Just knowing it was definitely supposed to work was a big help!

A few supplementary notes for anyone approaching the “How to Import the Aryzon Augmented Reality SDK Into Unity 3D” (July 16, 2018) video from the “Android” perspective:

  1. You need to have the “Unity Remote 5” app installed on the phone and running:
    Edit -> Project Settings -> Editor -> Unity Remote -> Device = "Any Android Device"
    You’ll probably also want to set Compression=PNG and Resolution=Normal.

  2. Somewhat counter-intuitively, you need to have
    Edit -> Project Settings -> Player -> Android -> XR Settings -> XR Enabled = UN-checked.
    This is the big thing that threw me off the first time around.
    Insofar as following that specific video goes, both ARCore and Vuforia should be unchecked under XR settings.

  3. Contrary to the Unity Remote instructions displayed on-screen, it works just fine if you use wifi instead of USB:

    (connect phone to computer via USB)
    adb tcpip 5555
    adb connect xxx.xxx.xxx.xxx
    (disconnect phone’s USB from computer)

(where “xxx.xxx.xxx.xxx” is the phone’s IP address)

Note that after you hit play, it might take a few seconds for Unity to begin streaming to the phone. Give it at least 10 seconds before assuming it failed.