红联Linux门户
Linux帮助

android简单命令

发布时间:2015-09-09 10:30:48来源:linux网站作者:水星灭绝

android命令,挑几个常用的记录一下。


1.查看android版本列表

命令:

./android  list  target


2.根据查看的版本号创立模拟器

命令:

./android  create  avd -n  magicyu  -t   8

显示:

Created AVD'mytest' based on Google APIs (Google Inc.),

with thefollowing hardware config:

hw.lcd.density=240

vm.heapSize=24


3.查看刚创立的模拟器

命令:

./android  list  avd

显示:

AvailableAndroid Virtual Devices:

Name: mytest
Path:D:\hai_software\android\android-sdk-windows_r06.setup\.android\avd\mytest.avd

Target: Google APIs (Google Inc.)

Based on Android 2.2 (API level 8)

Skin: WVGA800


4.启动模拟器

命令:

./emulator  -avd  mytest


5.选择启动皮肤

查看 platforms\android*\skins 下有哪些皮肤包:如 HVGA、QVGA、WQVGA400等

命令:

./emulator  -avd  magicyu -skin  QVGA


6.切换横竖屏

快捷键 ctrl+F11


7.使用adb 命令 进入platform-tools文件夹(android debug bridge)

命令:

./adb.exe    shell

显示:

显示linux命令界面


8.查看日志

1)在程序中添加日志

Log.v(Stringtag, String msg);------Verbose 冗长
Log.d(String tag, String msg);------Debug
Log.i(String tag, String msg);-------Info
Log.w(String tag, String msg);-----Warning
Log.e(String tag, String msg);------Error

2)控制台platform-tools目录下,输入查看命令

命令:

./adb.exe  logcat

显示:

日志信息


9.处理SD卡

1)建立SD卡

命令:

$ ./mksdcard  1024M  D:mysd.img

2)启动加载SD卡得模拟器

命令:

$ ./emulator.exe -avd mytest  -sdcard  mysd.img


10.拨打号码,发短信

1)telnet登录

命令:

$ telnet  localhost  5554

2)拨打号码

命令:

gsm  call  15555218135

显示:

模拟器上显示来电

3)发短信

命令:

sms  send  15555218135  Hellothis is a Message.

显示:

模拟器上显示短信内容

4)模拟器上安装apk文件

./adb.exe  install     my.apk

模拟器更改内存

$ ./emulator.exe -avd MyAvd0 -partition-size 400


9.查看连接的设备

adb devices


10.查看手机上安装的apk包名

$ adb shell pm list package


11.命令行启动程序

adb shell am start -n  包名/主activity名


12.adb超级终端运行 cp命令提示找不到

你路径可能有问题。cp不行一般输入busybox cp就行。


13.adb连接多个设备指定设备 格式为:adb -s <设备名称> 命令

比如,pull命令

adb -s SH0A6PL00243 pull data/data/com.android.tencent/databases/AgendaDetails.db f:\test 


如何在Ubuntu 15.04下创建一个可供Android/iOS连接的AP:http://www.linuxdiyf.com/linux/13909.html

Nexus5/Nexus6怎么刷安卓6.0?Android 6.0刷机教程:http://www.linuxdiyf.com/linux/13425.html

在64位ubuntu15.04中安装android studio开发环境:http://www.linuxdiyf.com/linux/12996.html

打造一个全命令行的Android构建系统:http://www.linuxdiyf.com/linux/13182.html