[英]Android device and Unity connection failure
I'm trying to debug Unity game from PC with Windows 10 to Android phone:我正在尝试从装有 Windows 10 的 PC 到 Android 手机调试 Unity 游戏:
File > Build Settings
I've Switch Platform
to AndroidFile > Build Settings
我已经将Switch Platform
到 AndroidSettings/About phone
with 7 taps on Build number
I get Developer Options
and turned on USB debugging and tap on Revoke USB debugging authorizationSettings/About phone
,点击 7 次Build number
我得到Developer Options
并打开 USB 调试,然后点击撤销 USB 调试授权 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:我已经用 3 部不同的手机检查了 2 条不同的 USB 电缆,并且每个设备都被 PC 操作系统成功检测和识别,Unity Remote 说“使用 USB 电缆将此设备连接到您的计算机。在 Unity 编辑器中按 PLAY 进行测试” ,但是由于某种原因,Unity Editor 没有在
Edit > Project Settings > Editor
device 中显示我的任何设备:
edit:编辑:
I've downloaded both Android Studio and separately sdk-tools-windows-4333796.exe
from Command line tools only .我只从命令行工具下载了Android Studio和单独的
sdk-tools-windows-4333796.exe
。
First I've installed from Java SE Development Kit 8u241 jdk-8u241-windows-x64.exe
for Windows x64首先,我从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
在 Windows 10 OS
Environment Variables/System Variables/Path
,我添加了C:\\Program Files\\Java\\jdk1.8.0_241\\bin
和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
在用户变量中,我添加了变量名称:
JAVA_HOME
和变量值: 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:所以,首先我没有使用
sdk-tools-windows-4333796.exe
并安装了 Android Studio,这是Edit > Preferences > External Tools
显示的内容:
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:然后,我删除了 Android Studio 并尝试仅使用
sdk-tools-windows-4333796.exe
,我已将tools
文件夹提取到以前创建的文件夹路径C:\\Android\\android-sdk
,然后从C:\\Android\\android-sdk\\tools\\bin
使用"platform;android-25"
或"platform;android-26"
参数加载sdkmanager.bat
,但错误显示:
Warning: File C:\\Users\\User.android\\repositories.cfg could not be loaded.
警告:无法加载文件 C:\\Users\\User.android\\repositories.cfg。 Warning: Failed to find package platform;android-25 [===
警告:找不到包平台;android-25 [===
] 10% Computing updates... C:\\Android\\android-sdk\\tools\\bin>] 10% 计算更新... C:\\Android\\android-sdk\\tools\\bin>
And finally I've tried install with Unity Hub:最后我尝试使用 Unity Hub 进行安装:
but it same result, device does not appears in Editor, and External Tools shows checked:但同样的结果,设备没有出现在编辑器中,并且外部工具显示选中:
and if unchecked:如果未选中:
I'm not quite sure, what I've missed or what I'm doing incorrectly我不太确定,我错过了什么或我做错了什么
Any guide, advice or example would be helpful任何指南、建议或示例都会有所帮助
For Unity Remote to work, you need to have the Android SDK on your development machine.要使 Unity Remote 工作,您需要在开发机器上安装 Android SDK。 Do you have it?
你有吗? If yes, then to specify the location of your Android SDK, go to Edit > Preferences.
如果是,则要指定 Android SDK 的位置,请转到“编辑”>“首选项”。 Unity Docs will help you.
Unity Docs将为您提供帮助。
To use Visual Studio 2019 to debug a Unity app running on an Android device connected to USB:要使用 Visual Studio 2019 调试在连接到 USB 的 Android 设备上运行的 Unity 应用程序:
Place breakpoints in the code for single stepping and watching and inspecting variables as needed.在代码中放置断点,以便根据需要进行单步执行以及观察和检查变量。 🎉
🎉
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.