更改亚行服务器运行在默认端口(如5037)

人气:3,666 发布:2022-09-12 标签: android default port adb

问题描述

我是一个萌芽的Andr​​oid开发人员,如果有配置ADB服务器到另一个端口运行,那么的没有简单的方法的的工具的会强迫我退出Android应用程序的开发。

一个网络搜索没有找到任何解决方案。

我也是在Android SDK中的所有文件搜索5037,但没有找到一个设置在那里。

解决方案

使用环境变量ANDROID_ADB_SERVER_PORT选择的端口。

在bash以下工作:

  $出口ANDROID_ADB_SERVER_PORT = 12345
$亚行启动服务器
*守护进程没有运行。现在在端口12345启动它*
*守护进程启动成功*
$ ADB设备
设备名单附后
TA2070M5O6设备
$ ANDROID_ADB_SERVER_PORT = 6789 ADB设备
*守护进程没有运行。现在在端口6789启动它*
*守护进程启动成功*
设备名单附后
 

在另一端,我跑:

  $ ANDROID_ADB_SERVER_PORT = 6789仿真器...
 

回到原来的终端:

  $ ANDROID_ADB_SERVER_PORT = 6789 ADB设备
设备名单附后
模拟器-5554设备
$ ADB设备#ANDROID_ADB_SERVER_PORT导出为12345
设备名单附后
TA2070M5O6设备
 

我因为我发现它运行通过詹金斯 Android模拟器插件发现了这个亚洲开发银行的不同端口上。

I am a budding android developer and if there is no easy way of configuring the adb server to run on another port then the inflexibility of the tools will force me to quit android app development.

A web search did not return any solutions.

I also searched for '5037' in all files in android sdk directory but did not find a setting there.

解决方案

Use the environment variable ANDROID_ADB_SERVER_PORT to select the port.

The following works under bash:

$ export ANDROID_ADB_SERVER_PORT=12345 
$ adb start-server
* daemon not running. starting it now on port 12345 *
* daemon started successfully *
$ adb devices
List of devices attached 
TA2070M5O6  device
$ ANDROID_ADB_SERVER_PORT=6789 adb devices
* daemon not running. starting it now on port 6789 *
* daemon started successfully *
List of devices attached 

In another terminal I ran:

$ ANDROID_ADB_SERVER_PORT=6789 emulator ...

Back to original terminal:

$ ANDROID_ADB_SERVER_PORT=6789 adb devices
List of devices attached 
emulator-5554   device
$ adb devices # ANDROID_ADB_SERVER_PORT was exported as 12345
List of devices attached 
TA2070M5O6  device

I found this via the Jenkins Android Emulator Plugin as I noticed it was running adb on a different port.

762