Search Unity

OVRADBTool adb server version (40) doesn't match this client (41)

Discussion in 'Android' started by giantkilleroverunity3d, Oct 28, 2020.

  1. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    Hello,
    I am trying to push a dev apk to a Oculus Quest.
    I get this error and this site search shows nothing but there are an immense amount of hits ww.
    Thank you.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Unity and most Android tools use adb to push stuff to device and get info from device. The recommendation is to make sure all your tools use the same Android SDK installation, then you'll be sure they all use the same SDK version and the same tools.
    There is an adb service that is started when you use adb and all adb instances connect to it, that's where the error comes from.
     
  3. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    Last edited: Oct 29, 2020
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    I think the issue is not with the Quest, the issue is - you have two Android SDK's on your PC, one comes from Unity (usually installed in Unity installation path) and the other one which probably installed manually somewhere else.

    For ex., you're saying "I am trying to push a dev apk", the adb executable you use to push, where does it come from?
     
  5. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I am in 2020.1.9f1. The PC is ADB ver 41, Unity's install is ADB ver 40, and the Quest is ADB ver 40.
    What I found was pretty bizarre. I went to through my pc to find all the ADBs. I then went to Unity/edit/preferences.
    The Android SDK was checked for Unity's ADB location and path(C:\Program Files\Unity\Hub\Editor\2020.1.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK) (ADB ver 40). This was one of the ADBs on my list. But this selection gives the server of 40(Quest) and client 41(PC) version mismatch error.
    In edit/preferences I uncheck the android sdk box and the android install sdk(not Unity's) path and location show up in the text box. It changed automagically.
    I run a test. Still an error. Of course. Its pointing to ADB ver 41.
    I run cmd/adb kill-server then reboot. I do not know if this helped but after all day I thought it would be a good idea.
    I then check the edit/preferences/sdk and the original entry of Unity's location comes up.
    Everything is back to what Unity wants as preferred and the location path text box goes gray/disabled with the Unity hub location path entry there.
    I do a 'BAR-Build And Run' And this compile works, the ADB connection works, and the APK push works.
    I know what happened:
    The Unity dev didnt bother using the preferred entry and assumed the Unity environment was the default setup.
    But this can not be true. This is why the BAR gives an error because the ADBs in the PC environment path entry are all versions 41and the Unity and Quest are 40. See? By me unchecking and checking the Unity Preferred, the Unity ADB (ver 40) command then is set up correctly and when the system executes the next ADB it uses Unity's path. This is sloppy programming practices at large. Or NFT(not fully tested). I could be wrong. But I just spent 20 hours trying to find a fix to this mess and basically am tired of fixing other's junk. I will not go back and retest as what I have now works and dont care to exercise that nightmare any more. This the answer that worked for me.
    So while what
    Tomas1856 posted above is true and initially the Unity panels all report this, the first time through is not the setup. Without changing any thing toggle the sdk box and see for yourself. It might only happen once and then everything is locked in place.
    Caveat emptor...
     
    Last edited: Oct 30, 2020
    jmcgraw961 likes this.
  6. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    It was late and I forgot the main fix...
    BAR = 'Build And Run'.
    I mention ADB verion 40 & 41 but no doubt this should fix any mismatches.
    In Unity go to file build settings. That is our BAR window.
    In Unity go to edit preferences. This is our SDK selection window.
    In the Unity edit preferences window you can switch a toggle for Unity's preferred SDK, 'Android install' or your own. Not yet. Follow along...

    First stretch that preference window wider to see the whole Unity's preferred SDK path.
    You can not edit it but click on the 'Copy Path' button and paste it in file explorere to navigate to that folder. ADB.exe is there. It is ver 40 that matches the Quest.
    Open up a command prompt there and execute an 'ADB version'. You should see version 40.
    The version report should validate that you are running from that copied path folder.

    In Unity if you run a Unity BAR now you will get the error that drove you here in the first place.
    Go back to the Unity edit preference window and unclick the SDK toggle.
    The textboxes change focus and you can see the Android install SDK path or an alternative if you have been here before changing things.
    At this point you can toggle that back and forth to see the textbox changes. But make sure to to leave it at the Unity default for this test.
    If you run a BAR now you will get the error that drove you here in the first place.
    In the edit preferences window unclick the SDK selection toggle to open the Android SDK text box and replace the entry with the path copied from the file explorer that is pointing to the Unity preferred location.
    Run a BAR. You should not receive an error. Great!
    Now lets clean up.
    In the Unity edit preference window click the SDK selection back to Unity's recommendation.
    See that entry? It was the same as before and is the same as the replaced Android SDK textbox selection we just changed and tried.
    You cant change the Unity edit preferred entry but is now the same as Android entry as the file explorer.
    We are back to where this exercise started. But are we?
    Run a BAR. You should not receive an error. Great!
    Why? Read the previous post.
    But now on the Quest the APK launches and I get a black screen. Next issue.
     
    Last edited: Oct 30, 2020
  7. pigeonmeat

    pigeonmeat

    Joined:
    Feb 12, 2014
    Posts:
    4
    I can't believe this worked......... but it did. Thanks a bunch giantkilleroveru ^_^
     
  8. wechat_os_Qy01eDJfSV7CWSHuAPwDqgMCA

    wechat_os_Qy01eDJfSV7CWSHuAPwDqgMCA

    Joined:
    Aug 4, 2022
    Posts:
    8
    I had the same issue. If you can't fix with the above steps like me, somehow selecting + deselecting the SDK toggle plus typing
    Code (CSharp):
    1. adb devices
    in the command line in the original SDK directory works for me....