Build Project to Android Error: Unable to start ADB server.

Hello,
When I try to build my Unity project to my android device, it gives the error: Unable to start ADB server. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
I have the Android SDK, NDK and JDK all set up.
I have looked up for the error, but I really can’t find a solution.
I’m in Unity 2019.3.0a11, is it possible I have this error because I’m in an alpha version?
Does anyone have a link with the steps to build Unity projects to Android? Or does anyone know how to fix this error?

Thanks in case

My solution was to close my android emulator, Nox.

Took me a very long time to realize I just needed to close it :slight_smile:

@Samuel014 Hi, I solved this error just yet! it caused by overlap between the two adb.exe : one at the SDK folder that you instruct Unity to search, the other one at your phone’s driver folder–>remove this one!
Then you can use cmd to check if the right adb.exe is detected.
you can see the figure that I attached.
Hope this is useful to you.
[153694-如何讓untiy正確讀到手機.png|153694]

My issue appears to be that the ADB server is not starting up automatically… or that the wrong one is starting. I’m not yet sure which.

Unity tools will install its own Android toolset.

My resolve was to:

  • open the Windows console as admin (cmd… run as admin)
  • type the following: “C:\Program Files\Unity\Hub\Editor\2019.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe” kill-server
  • type the following: “C:\Program Files\Unity\Hub\Editor\2019.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe” start-server

Note that your path to adb may be different.

Thanks for the replies. I tried all of it but keep getting the same error in the command prompt: "adb server version (39) doesn’t match this client (40); killing…
could not read ok from ADB Server

  • failed to start daemon
    error: cannot connect to daemon", I really don’t know what this means. I’m only 14 years old but I did build a game and know how to code, but I barely understand anything about all the other stuff on how to set it up like what SDK’s and ADB and all of this is. So now I’m trying to build my game for an Android tablet so I can test it of course. But like I said above, I keep getting the same errors, and when I look them up, I can’t find anything to solve it. So does anyone know a detailed tutorial or something on how to do this or on how to solve this errors?

I was able to solve the problem by closing Unity, connecting the android device, restarting Unity, enter play mode once, exit playmode and then build and run to the device.

Seems the 2019.3 release version is still a bit buggy.

EDIT: In the end it was also the HTC manager, that was installed by my phone, that started up it’s own ADB server, instead of the Unity ADB server. Deleted the HTC Sync Manager and all was working normally again. To find to out if there is another adb starting up, just plug your phone into the PC (with Unity closed) and check the Task manager for a running adb.

Not sure if this will help others but what fixed it for me was going to edit->preferences->external tools and then checking the boxes to use the SDK and JDK installed with unity

I had this problem with Huawei P30 Lite and Samsung Galaxy Tab E. Installed Samsung Driver, Disabled Firewall (McAfee) and still didn’t work.

Solution:
I had to install Android Studio along with SDK, and during its installation, it tells you where the SDK will be installed (in my case at C:\Users[My Name]\AppData\Local\Android\Sdk). I copied this location, went to Unity → Edit → Preferences → unchecked Android SDK…and replaced this new sdk folder location there. Finally, closed Unity, restarted my computer and it worked.

Thanks for this! I had a copy of ADB in a program that allows me to use my phone as a second monitor (XDisplay) and deleting that allowed Unity to compile.

In my case, I found that the Oculus Developer Hub program came with its own version of ADB, and that copying the following files from my Unity platform-tools folder into the Oculus Developer Hub folder resolved the issue.

Files:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll

Unity folder:
/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools

Oculus Developer Hub folder:
C:/Program Files/Oculus Developer Hub/resources/bin,In my case, I found that the Oculus Developer Hub program came with its own version of ADB, and that copying the following files from my Unity platform-tools folder into the Oculus Developer Hub folder resolved the issue.

Files:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll

Unity folder:
/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools

Oculus Developer Hub folder:
C:/Program Files/Oculus Developer Hub/resources/bin

problem fixed here : Unity 2020 Android Support: Setup, SDK & NDK & JDK & Gradle - YouTube

For Oculus Quest builds you may need to close the Oculus Developer Hub or Sidequest (or both). This worked for me.