parent
fe61540e84
commit
8551afb5cf
|
@ -238,7 +238,8 @@ public class MobileDeviceConnection extends AbstractDeviceConnection {
|
||||||
} catch (SessionNotCreatedException e) {
|
} catch (SessionNotCreatedException e) {
|
||||||
log.error("Driver创建失败,设备连接失败", e);
|
log.error("Driver创建失败,设备连接失败", e);
|
||||||
String errorMessage = String.format("the local port #%s is busy", deviceInfo.getForwardPort());
|
String errorMessage = String.format("the local port #%s is busy", deviceInfo.getForwardPort());
|
||||||
if (e.getMessage().contains(errorMessage)) {
|
String epermMsg = "eperm"; // EPERM 大概率是系统拒绝了这次连接,释放一下端口重新连接
|
||||||
|
if (e.getMessage().contains(errorMessage) || e.getMessage().toLowerCase().contains(epermMsg)) {
|
||||||
log.warn("设备【{}】adb转发的端口【{}】被占用了,释放了重新来", deviceId, deviceInfo.getForwardPort());
|
log.warn("设备【{}】adb转发的端口【{}】被占用了,释放了重新来", deviceId, deviceInfo.getForwardPort());
|
||||||
boolean success = AndroidUtil.releaseAdbForwardPort(this.remoteAddress, deviceId);
|
boolean success = AndroidUtil.releaseAdbForwardPort(this.remoteAddress, deviceId);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
Loading…
Reference in New Issue