android 模拟器 和 adb 的一些tips



手动建立模拟器

./mksdcard 512M sd01
  512M是SD卡大小,sd01是指卡的名称
./android create avd -n phone01 -t 2
       参数 -n  name -t targetId
       运行后出现
  Auto-selecting single ABI armeabi-v7a
  Created AVD 'myphone01' based on Google APIs (Google Inc.), ARM (armeabi-v7a) processor,
  with the following hardware config:
  hw.lcd.density=240
  vm.heapSize=48
  hw.ramSize=512

运行模拟器
sudo ./emulator @phone01 -sdcard sd01 -scale 0.8




模拟器上网设置:

android 模拟器默认情况下是无法上网的,因为其默认的DNS是10.0.2.3,可将其设为本机IP
Ubuntu 下可用 ifconfig查看IP
adb shell进入模拟器shell
getprop 查看系统各项属性
其中[net.dns1]: [10.0.2.3] 
setprop net.dns1 192.168........


adb指定设备安装apk:

sahwn@EP43:~/IdeaProjects/untitled$ adb --help
Android Debug Bridge version 1.0.31
 -s <specific device>          - directs command to the device or emulator with the given
                                 serial number or qualifier. Overrides ANDROID_SERIAL
                                 environment variable.
 
 devices [-l]                  - list all connected devices
                                 ('-l' will also list device qualifiers)
 
device commands:  
  adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
                               - push this package file to the device and install it
                                 ('-l' means forward-lock the app)
                                 ('-r' means reinstall the app, keeping its data)
                                 ('-s' means install on SD card instead of internal storage)
                                 ('--algo', '--key', and '--iv' mean the file is encrypted already)
  


sahwn@EP43:~/IdeaProjects/untitled$ adb -s HC34XW903192  install -r untitled.apk3857 KB/s (979989 bytes in 0.248s)
	pkg: /data/local/tmp/untitled.apk
Success



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值