安卓模拟器设置网速和延迟

有时候做APP,需要测试在低网速或高延迟的网络环境下工作,android官方模拟器对此提供了很好的支持(真是越来越好用了),设置方法有两种,界面和命令行。

界面设置

这里写图片描述

命令行设置

the Android emulator supports network throttling, i.e. slower network
bandwidth as well as higher connection latencies. this is done either through
skin configuration, or with ‘-netspeed ’ and ‘-netdelay ’.

the format of -netspeed is one of the following (numbers are kbits/s):

-netspeed gsm          GSM/CD           (up: 1.8 KiB/s, down: 1.8 KiB/s)
-netspeed hscsd        HSCSD            (up: 1.8 KiB/s, down: 7.0 KiB/s)
-netspeed gprs         GPRS             (up: 3.5 KiB/s, down: 7.0 KiB/s)
-netspeed umts         UMTS/3G          (up: 46.9 KiB/s, down: 46.9 KiB/s)
-netspeed edge         EDGE/EGPRS       (up: 57.8 KiB/s, down: 57.8 KiB/s)
-netspeed hsdpa        HSDPA            (up: 703.1 KiB/s, down: 1706.5 KiB/s)
-netspeed lte          LTE              (up: 7080.1 KiB/s, down: 21118.2 KiB/s)
-netspeed evdo         EVDO             (up: 9155.3 KiB/s, down: 34179.7 KiB/s)
-netspeed full         no limit         (up: 0.0 KiB/s, down: 0.0 KiB/s)

-netspeed         select both upload and download speed
-netspeed :  select individual up and down speed

The format of -netdelay is one of the following (numbers are msec):

-netdelay gsm          GSM/CD           (min 150, max 550)
-netdelay hscsd        HSCSD            (min 80, max 400)
-netdelay gprs         GPRS             (min 35, max 200)
-netdelay umts         UMTS/3G          (min 35, max 200)
-netdelay edge         EDGE/EGPRS       (min 80, max 400)
-netdelay hsdpa        HSDPA            (min 0, max 0)
-netdelay lte          LTE              (min 0, max 0)
-netdelay evdo         EVDO             (min 0, max 0)
-netdelay none         no latency       (min 0, max 0)
-netdelay         select exact latency
-netdelay :   select min and max latencies

the emulator uses the following defaults:

Default network speed   is 'full'
Default network latency is 'none'

只要在启动的时候设置一下参数就好了,比如

 /android_env/sdk/tools/emulator -netdelay none -netspeed umts -avd Nexus_5X_API_23

你可能感兴趣的:(Android,android)