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

有时候做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 <num>        select both upload and download speed
-netspeed <up>:<down>  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 <num>        select exact latency
-netdelay <min>:<max>   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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值