Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

5.6.0b3 (Linux) Daydream Controller Emulator won't work, "adb command not found."

Discussion in 'Daydream' started by Jesse_DuBord, Jan 16, 2017.

  1. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    I can't get the controller emulator to work in Unity 5.6b3 under Arch Linux 64-bit. In Play mode, the console shows the following:

    "Android Debug Bridge (`adb`) command not found.
    Verify that the Android SDK is installed and that the directory containing `adb` is included in your PATH environment variable."

    In Windows, you have to add the directory containing the Android Debug Bridge (adb) program to the PATH environment variable in Windows itself (not in the Unity program). You have to do the same in Linux, evidently, to get Unity to locate adb and therefore get the Controller Emulator phone working.

    I've added the following line in my .bashrc file in my home directory:

    "PATH=~/Android/Sdk/platform-tools/:$PATH"

    This, however, doesn't fix the issue.

    I don't know how to add the directory containing adb to the PATH environment variable that Unity needs to make the Controller Emulator work.

    Is anyone else having this issue? Is there a fix or work-around?
     
    Last edited: Jan 17, 2017
  2. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    UPDATE #1: I've submitted a bug report on the Documentation of Daydream and Unity (https://fogbugz.unity3d.com/default.asp?871193_sue1plsphirue89b). Hopefully they can provide a quick step, blurb or link that will allow users to quickly add what is needed for Unity to recognize adb and get the Controller Emulator working -- both in Linux and Windows.
     
  3. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    Is this the Controller Emulator for Daydream that you are talking about?
     
  4. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Hi @joejo, thanks for your reply. Yes, the Controller Emulator for the Daydream View VR headset is what I'm talking about. Specifically, in Play Mode, the scene won't react to commands or rotations from the mobile phone running the Controller Emulator -- primarily (I believe) because the adb command isn't found. At least, that's what the Console is telling me.
     
  5. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    A couple things here:

    1) Did you export your changed path? I.e. export PATH=~/Android/Sdk/platform-tools/:$PATH
    2) Did you launch Unity from a shell where that export is set? I'm not sure if launching Unity from outside a command line will pick up any changes you made in your command environment. I have no experience with Arch Linux so I am not sure where to add that to your global environment to have it picked up by launched applications.
     
  6. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    Also a caveat: Google is not maintaining the controller emulator anymore now that the Daydream viewer/controller are available. The emulator may or may not work for you but if you get over this adb issue and it doesn't work there isn't much we (Unity) can do in that regard. You'll have to contact Google and see if they can help you.
     
  7. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Thanks for the info', @joejo. I tried using the GNOME terminal to export the path (command "export PATH=~/Android/Sdk/platform-tools/:$PATH"), then ran the Unity 5.6b3 beta from the terminal (command "unity-editor-beta"). The adb command still wasn't found.

    I have a Daydream View headset with controller. If Google's no longer supporting the emulator and there's an easier way to set up the proper Daydream Controller with Unity, I'd be more than happy with that. :) Is there a way to do that, currently?
     
  8. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    Not for the editor, at least nothing publicly available that I am aware of.

    If you look in Unity preferences there are paths that have to be set to point to the Android SDK and NDK, as well as Java. Are these set at all?
     
  9. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Gotcha, I'm sure there will be news eventually with docs on how to get this done. It'd be much easier for developers to use the proper controller anyways, you know?

    Yes, I have set all of them to the proper folder destination -- that's actually what confused me at first. I'd assumed that since I set the external path to the Android SDK, that adb would have been recognized as part of the package (since it's right in the "platform-tools" folder in the root Android SDK directory). I was hoping there was something I could do in Unity to point whatever necessary Google VR SDK files to that directory. I can take this request to Google VR as well -- I'd just need to get pointed in the right direction.

    Appreciate the help!
     
  10. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    A couple more things before I empty my bag here: Manually expand out ~ and try adding the path to the tools subfolder as well as platform-tools.
     
  11. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    I tried to add the tools subfolder (command "export PATH=~/Android/Sdk/platform-tools/:~/Android/Sdk/tools/:$PATH"), but Google VR SDK still didn't see adb. I even tried copying & pasting the adb program file to tools folder, and even the home directory. Could it be that Google VR SDK is coded to use the Windows file structure when searching for adb directory location? (e.g. "C:\Users\"...etc)
     
  12. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    No, because it works on Mac. And with the path changes you can find adb when you attempt to call it directly from the command line? I would suggest making sure that you can correctly access adb from there and, if so, I would think that the issue would be a global environment setting problem.

    The other thing is to make sure that all of your ~ are replaced with fill paths to your home folder, especially in the Unity preferences.
     
  13. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    I can run adb from the gnome-terminal and Xterm command lines without issue.

    I'll check to make sure there are no ~'s in my paths. Apart from the Preferences>External Tools fields, is there anywhere else that should have the "~" replaced with "/home/user/"?
     
  14. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    If you set it in a global environment somewhere you might need to change that as well.
     
  15. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    I really appreciate all of the tips and possible solutions you're providing, thank you.

    According to what I'm reading on the Interwebs, in most Linux distros, adding the line "PATH=/home/jesse/Android/Sdk/platform-tools/:$PATH" to the .bashrc and/or .profile files in the user home directory is the way to set the global environment variables, which are applied at user login. I've added that line to my user's .bashrc and .profile files, as well as made sure that the Unity Preferences > External Tools is pointing to the rood directory of the Android sdk ("/home/jesse/Android/Sdk/". I've also confirmed that in both gnome-terminal and Xterm, I can run the adb program by simply typing in "adb".

    However, the problem still remains: in Unity, when a mobile phone is attached via USB (with USB debugging enabled) & running the Controller Emulator app provided by Google, and when I have the GVRDemo scene loaded and press Play to enter Play Mode, there is no Daydream controller present in the scene. Console still shows "Android Debug Bridge (`adb`) command not found. Verify that the Android SDK is installed and that the directory containing `adb` is included in your PATH environment variable." :/ Adding the path "C:\Users\Jesse\AppData\Local\Android\Sdk\platform-tools\" to the PATH environment variable in Windows 10 fixed this issue in the Windows build of 5.6.b3 right away.

    Is there anything else that could be causing this error?
     
    sivrikaya likes this.
  16. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
  17. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    960
    Sounds like a bug in Google tools to me. We don't require adb to be in the path.
     
  18. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Thanks for the info', @Yury-Habets. Do you know where I can go to report this issue to the Google VR guys?
     
  19. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    960
  20. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    I was able to locate the culprit and modify Google VR SDK scripts to make it work! Turns out there was an issue in the code of the script file titled "EmulatorClientSocket.cs" regarding non-Windows machines. Here's what I changed, and why:

    Originally, in line 111 and 112 of this script, it read:
    stringprocessFilename="bash";
    stringprocessArguments = string.Format(" -l -c \"{0}\"", adbCommand);


    The context is that when Windows is not present (forgive my layman's terms -- I've only started learning coding a month ago) the command to process is this: bash -l -c "adb forward tcp:7003 tcp:7003". The problem is when the -l option is used in the command, the command is interpreted as if coming from a login shell, which - I believe - means that bash isn't looking at the custom environment variables set in the user's .bashrc and .profile files in their home directory. Without looking at those files, bash can't locate the adb command (try running the bold command above in a terminal, and the result will be a prompt saying adb command not found).

    To fix it, I simply removed the -l option from line 112, and, voila! Everything works like a charm! Lines 111 and 112 now look like this:
    stringprocessFilename="bash";
    stringprocessArguments = string.Format(" -c \"{0}\"", adbCommand);


    Now the question is: how can I submit this issue to Google VR devs so that they can look this over and other users won't have this issue when developing for Daydream in Unity?
     
    ilmario likes this.
  21. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Minor update: Controller emulator will run fine when Unity is started from gnome-terminal or Xterm, but starting it stand-alone from the applications menu still produces the "adb command not found" error.
     
  22. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
  23. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    Most likely because the PATH env is being passed from Unity to the Google SDK, and that doesn't exist in your global (non-shell) environment. When started from Xterm Unity will start with the PATH env set as part of the shell environment.
     
  24. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    529
    Sorry! I didn't post it I was pointing out that was what you should do! :)

    After all, you figured it out you should get the glory and recognition.
     
  25. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Haha, I just re-read your comment and deleted my other one. Sorry, my bad! Sure thing, I'll post the pull request. :)
     
  26. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
  27. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    UPDATE: Editing the code for GoogleVR SDK doesn't seem necessary in the latest 5.6.0b6 Linux build published by Unity Technologies, but that may need additional testing for confirmation. For me, adding the PATH before starting Unity 5.6 seems to recognize the controller emulator fine when starting the in-game testing.
     
  28. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    Hi @Jesse_DuBord, I've been cracking my head against this problem all over the internet and haven't been able to find a solution. I'm using 5.6 Beta, have a Pixel XL, on OSX, and am running the emulator and came across the same "adb command not found" problem.

    I'm a bit of a noob when it comes to the more technical side with bash and whatever... Can you explain how you solve the problem to me in layman's terms? What do you mean by adding the PATH? Where? How?

    I've tried the editing line 111 and 112 thing that you proposed above but it doesn't work, like you said above too.

    Much, much appreciated!
     
  29. jeffries7

    jeffries7

    Joined:
    Jun 25, 2014
    Posts:
    39
    I'm using 5.6.1f1 on Windows with GoogleVR 1.5, I too was having issue with connecting the controller emulator. The solution that Jesse_DuBord suggests seems to work(changing EmulatorClientSocket.cs). Hopefully this is addressed in new versions of GoogleVR.
     
  30. ncheruku

    ncheruku

    Joined:
    Jun 6, 2017
    Posts:
    4
    Hi @Tuism I have the same issue. Editing those lines didn't help. Were you able to fix it
     
  31. Rex-Raptor

    Rex-Raptor

    Joined:
    Feb 10, 2015
    Posts:
    2
    What worked for me was to set up the player settings for android and daydream vr BEFORE importing any daydream/google Vr packages. Give that a shot and see if that works out for you.
     
  32. ddi7i4d

    ddi7i4d

    Joined:
    Sep 21, 2017
    Posts:
    7
    @Tuism @Jesse_DuBord
    Do you still have this problem with newer Unity builds and the GoogleVR 1.70 SDK? I am having that problem, and I have tried everything that was suggested here and other communities, it is so frustrating. Not sure if I understand what Xterm means though. I don’t know what I should do, any help is appreciated.

    Edit: The easiest solution would be just to use WiFi connection instead of USB, so you don’t need adb. So at least the controller works, which is a huge relief!
     
    Last edited: Sep 21, 2017
  33. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    @ddi7i4d, I haven't tested in quite a while. When I have time I can download the latest Ubuntu-based build of Unity and can try it out, then. Ubuntu is coming out with 17.10, soon, which is their latest release. I'll try it on a fresh install around that time.
     
  34. CNR-EpiTel

    CNR-EpiTel

    Joined:
    Aug 23, 2018
    Posts:
    11
    pathvariable management.PNG usbdriver.PNG
    I have had NO problem with it,
    The problem is not google. It is Unity: The google vr daydream links within the Android updates. Unity is not recognising the Android SDK updates. I had no problem with Gvr but the new Unity release is not recognising Android SDK updates. Within the SDK is where the adb is.

    I just worked super hard, to go through and learn android kotlin-firebase last week, the whole excrutiating week.
    I come back to Unity which had an update and tried different versions when the controller issue appeared.
    I ignored it so that I could keep my workflow which is to now structure the php mysql for hsoting the games on my website and likewise, making it easier to track through different options within the same android UI, play them, send the data to mysql and give back results.

    Everything works fine except unity does not recognise the latest Android sdk, and it should - regarldess of whether or not you have controller.
    So it is not google vr.
    It is the fact that Android has updates in its SDK and that unity is not listening to those.As as result apk is not reached.
     
    Last edited: Oct 8, 2018
  35. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    960
    @CNR-EpiTel did you notice the initial discussion was about issues on Linux, while you are using Windows?
     
  36. CNR-EpiTel

    CNR-EpiTel

    Joined:
    Aug 23, 2018
    Posts:
    11
    Have you got anything more helpful?
    Or, have you looked at all the related posts that talk about Mac too.
    If it means there's a solution temporarily by switching to linux, i would. This is excrutiatingly slow and a lot of hours with no result but yours