Search Unity

Resolved Android Plugin on Oculus Quest

Discussion in 'VR' started by imerso, Feb 14, 2021.

  1. imerso

    imerso

    Joined:
    May 6, 2011
    Posts:
    278
    Hello,


    I wrote a custom Android Plugin which works perfectly on a conventional Android phone. I tested with Mono and IL2CPP backends, both ARMv7 and ARM64 architectures, and it worked nicely.

    To my surprise, though, when I started using it (the plugin) on the Oculus Quest VR version of the same project -- with everything else equal, plugin in the same Plugins/Android/Libs folder -- I got the "E Unity : Unable to find MyAndroidPlugin" error.

    I even tried running the flat phone version -- which works perfectly on a conventional phone -- on Quest and got the same error. I would not be so surprised if my plugin was incompatible with Quest, but... "unable to find" at load time sounds a bit weird and unexpected to me.

    Does the Oculus Quest have any particular difference to a conventional Android regarding Unity plugins?


    Thanks.
     
    Last edited: Feb 14, 2021
  2. imerso

    imerso

    Joined:
    May 6, 2011
    Posts:
    278
    Actually, I suspect that this might be a Unity 2019.4 bug.

    Would be really nice if someone from Unity could confirm if 2019.4 is able to find Android plugins at Plugins/Android/Libs or not -- I mean, on Oculus Quest, because on a conventional Android device it does work perfectly.

    - Does Oculus Quest support Android plugins (pure, highly tested Java classes) at all?
    - Does Unity pack and deploy Plugins/Android/Libs on Oculus Quest?
    - Does Unity really look at Plugins/Android/Libs at loading time, on Oculus Quest?

    Please note that this is not a matter of plugin compatibility yet*. Unity is not finding the plugin at all.

    * although I am very confident that my plugin will be perfectly compatible with Quest, though, when Unity finds it.

    Thanks.
     
  3. imerso

    imerso

    Joined:
    May 6, 2011
    Posts:
    278
    Well, I found out and fixed the problems. Not really a bug, but still a weird behaviour imho. First, I moved from Plugins/Android/Libs to just Plugins/Android. Apparently that changed something (?). Then, I got an instantiation error.

    My class constructor had a parameter which I was not providing. I was instantiating with

    Code (CSharp):
    1. instance = new AndroidJavaObject("class_name");
    That is, without the required parameter. Honestly I assumed that null would pass through. Interesting enough, on my phone it was working normally without complaints, but on Quest it was not finding the method.

    It is working nicely now. =)
     
    keli95566 likes this.