unity3D 直连android时,build failure

错误信息

这里写图片描述
这里写图片描述
这里写图片描述

问题所在

我的情况是:可以build出.apk在PC端,但不能把apk直连发送至手机。所以是连接问题。
应该是adb的问题,5037端口被占用了。

解决方法

1.如果电脑上有装xx手机助手、豌豆荚、刷机精灵,在任务管理器上关闭或直接卸载掉就好了。
2.如果没有装,就看看有什么占用了5037端口:
①打开命令行,输入命令:netstat -ano |findstr "5037",记住PID号,在任务管理器删掉就好了(如果是adb.exe占用也删掉,我的就是这种情况)
②最后输入adb devices,如果有下图的显示,就成功解决啦~!
这里写图片描述
如果还不行可以试试执行这2条命令adb kill-server, adb start-server,因为我也试了下,我不清楚这2条命令有没有效。

unity直连android真机的方法参照:https://blog.csdn.net/liushida00/article/details/49797239


报错信息:

CommandInvokationFailure: Unable to retrieve device properties. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
C:/Users/sakura/AppData/Local/Android/sdk\platform-tools\adb.exe -s “28b562580704” shell getprop

stderr[
error: unknown host service
]
stdout[

]

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

猜你喜欢

转载自blog.csdn.net/Sakura_Jun/article/details/82631251