Home » Android » unity3d – Android device and Unity connection failure-Exceptionshub

unity3d – Android device and Unity connection failure-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I’m trying to debug Unity game from PC with Windows 10 to Android phone:

  1. In Unity from File > Build Settings I’ve Switch Platform to Android
  2. In Android device I’ve downloaded and installed Unity Remote 5 application.
  3. In phone Settings/About phone with 7 taps on Build number I get Developer Options and turned on USB debugging and tap on Revoke USB debugging authorization
  4. In Select USB Configuration I’ve checked PTP (Picture Transfer Protocol)

I’ve checked 2 different USB cables with 3 different phones and each device is successfully detected and recognized by PC OS, Unity Remote says “Connect this device with a USB Cable to your computer. Press PLAY in the Unity Editor to test”, but Unity Editor by some reason does not shows any of my devices in Edit > Project Settings > Editor device:

enter image description here

edit:

I’ve downloaded both Android Studio and separately sdk-tools-windows-4333796.exe from Command line tools only.

First I’ve installed from Java SE Development Kit 8u241 jdk-8u241-windows-x64.exe for Windows x64

In Windows 10 OS Environment Variables/System Variables/Path, I’ve added C:\Program Files\Java\jdk1.8.0_241\bin and C:\Program Files\Java\jre1.8.0_241\bin

In User Variables I’ve added Variable name: JAVA_HOME and Variable value: C:\Program Files\Java\jdk1.8.0_241\bin

So, first I did not used sdk-tools-windows-4333796.exe and have installed Android Studio, here is what Edit > Preferences > External Tools shows:

enter image description here

Then, I’ve removed Android Studio and tried to use only sdk-tools-windows-4333796.exe, I’ve extracted tools folder to previously created folders path C:\Android\android-sdk, then from C:\Android\android-sdk\tools\bin load sdkmanager.bat with "platform;android-25" or "platform;android-26" argument, but error says:

Warning: File C:\Users\User.android\repositories.cfg could not be
loaded. Warning: Failed to find package platform;android-25 [===
] 10% Computing updates… C:\Android\android-sdk\tools\bin>

And finally I’ve tried install with Unity Hub:

enter image description here

but it same result, device does not appears in Editor, and External Tools shows checked:

enter image description here

and if unchecked:

enter image description here

I’m not quite sure, what I’ve missed or what I’m doing incorrectly

Any guide, advice or example would be helpful

How to&Answers:

For Unity Remote to work, you need to have the Android SDK on your development machine. Do you have it? If yes, then to specify the location of your Android SDK, go to Edit > Preferences. Unity Docs will help you.