【网学网提醒】:本文主要为网学会员提供android 命令大全,希望对需要android 命令大全网友有所帮助,学习一下!
android命令大全
目录11223344android.batemulator.exeddms.bat系统信息
编辑本段回目录1
android.bat
1.1
查看帮助信息:Android.bat–h或android.bat–help
1.2
创建avd
(1)android.batcreateavd-t1-c256M-pE:\android_sdk\android-SDK-windows-1.6_r1\platforms\android-1.6\images-navd16-f-sHVGA(2)android.batcreateavd-t2-c256M-pE:\android_sdk\android-sdk-windows-1.6_r1\platforms\android-1.6\images-navd2-f-sHVGA以上,用不同的设置创建avd.(3)直接用”android.bat”命令可以启动AndroidSDK图开界面(如下图),用它也可以创建avd;(4)在eclipse中,点击工具栏中的“opentheavdandSDKmanager”图标来打开上图。1.3listAvailableAndroidtargets:id:1Name:Android1.5Type:PlatformListsexistingtargetsorvirtualdevicesE:\android_sdk\android-sdk-windows-1.6_r1\tools>android.bat
APIlevel:3Revision:1Skins:HVGA(default),HVGA-L,HVGA-P,QVGA-L,QVGA-Pid:2Name:Android1.6Type:PlatformAPIlevel:4Revision:1Skins:HVGA(default),QVGA,WVGA800,WVGA854id:3Name:googleAPIsType:Add-OnVendor:GoogleInc.Revision:3Description:Android+GoogleAPIsBasedonAndroid1.5(APIlevel3)Libraries:*com.google.android.maps(maps.jar)APIforGoogleMapsSkins:QVGA-P,HVGA-L,HVGA(default),QVGA-L,HVGA-Pid:4Name:GoogleAPIsType:Add-OnVendor:GoogleInc.Revision:1Description:Android+GoogleAPIsBasedonAndroid1.6(APIlevel4)Libraries:*com.google.android.maps(maps.jar)APIforGoogleMapsSkins:WVGA854,HVGA(default),WVGA800,QVGAAvailableAndroidVirtualDevices:Name:avd16Path:C:\DocumentsandSettings\lizhongyi\.android\avd\avd16.avdTarget:Android1.6(APIlevel4)
Skin:HVGA--------Name:avd2Path:C:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avdTarget:Android1.6(APIlevel4)Skin:QVGA1.4ListsexistingAndroidVirtualDevicesE:\android_sdk\android-sdk-windows-1.6_r1\tools>androidlistavdAvailableAndroidVirtualDevices:Name:avd16Path:C:\DocumentsandSettings\lizhongyi\.android\avd\avd16.avdTarget:Android1.6(APIlevel4)Skin:HVGA--------Name:avd2Path:C:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avdTarget:Android1.6(APIlevel4)Skin:QVGA1.5ListsexistingtargetsE:\android_sdk\android-sdk-windows-1.6_r1\tools>androidlisttargetAvailableAndroidtargets:id:1Name:Android1.5Type:PlatformAPIlevel:3Revision:1Skins:HVGA(default),HVGA-L,HVGA-P,QVGA-L,QVGA-Pid:2Name:Android1.6Type:PlatformAPIlevel:4Revision:1
Skins:HVGA(default),QVGA,WVGA800,WVGA854id:3Name:GoogleAPIsType:Add-OnVendor:GoogleInc.Revision:3Description:Android+GoogleAPIsBasedonAndroid1.5(APIlevel3)Libraries:*com.google.android.maps(maps.jar)APIforGoogleMapsSkins:QVGA-P,HVGA-L,HVGA(default),QVGA-L,HVGA-Pid:4Name:GoogleAPIsType:Add-OnVendor:GoogleInc.Revision:1Description:Android+
GoogleAPIsBasedonAndroid1.6(APIlevel4)Libraries:*com.google.android.maps(maps.jar)APIforGoogleMapsSkins:WVGA854,HVGA(default),WVGA800,QVGA
编辑本段回目录2emulator.exe
2.1
启动模拟器
(1)最简单的方法(用avd):emulator-avdavd2(2)按尺寸启动模拟器emulator.exe-avdavd2-scale0.7(3)启动userdata.imgemulator-datauserdata.img(4)启动system.imgemulator-datasystem.img(5)使用-verbose选项
E:\android_sdk\android-sdk-windows-1.6_r1\tools>emulator-verbose-avdavd2emulator:foundSDKrootatE:\android_sdk\android-sdk-windows-1.6_r1emulator:rootvirtualdevicefileatC:\DocumentsandSettings\lizhongyi\.android/avd/avd2.iniemulator:virtualdevicecontentatC:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avdemulator:virtualdeviceconfigfile:C:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avd/config.iniemulator:emulator:lockinguserdataimageatC:\DocumentsandlockingcacheimageatC:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avd/userdata-qemu.imgSettings\lizhongyi\.android\avd\avd2.avd/cache.imgemulator:ignoringnon-existingSDCardatC:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avd/sdcard.img:Nosuchfileordirectoryemulator:foundskin'QVGA'indirectory:E:\android_sdk\android-sdk-windows-1.6_r1/platforms\android-1.6\skinsemulator:autoconfig:-skinQVGAemulator:autoconfig:-skindirE:\android_sdk\android-sdk-windows-1.6_r1/platforms\android-1.6\skinsemulator:keysetloadedfrom:C:\DocumentsandSettings\lizhongyi\.android\default.keysetemulator:tryingtoloadskinfile'E:\android_sdk\android-sdk-windows-1.6_r1/platforms\android-1.6\skins/QVGA/layout'emulator:skinnetworkspeed:'full'emulator:skinnetworkdelay:'none'emulator:registered'boot-properties'qemudserviceemulator:registered'boot-properties'qemudserviceemulator:Addingbootproperty:'qemu.sf.lcd_density'='120'emulator:argv[00]="emulator"emulator:argv[01]="-kernel"emulator:argv[02]="E:\android_sdk\android-sdk-windows-1.6_r1/platforms\android-1.6\images\/kernel-qemu"emulator:argv[03]="-initrd"emulator:argv[04]="E:\android_sdk\android-sdk-windows-1.6_r1/platforms\android-1.6\images\/ramdisk.img"
emulator:argv[05]="-nand"emulator:argv[06]="system,size=0x4200000,initfile=E:\android_sdk\android-sdk-windows-1.6_r1/platforms\android-1.6\images\/system.img"emulator:argv[07]="-nand"emulator:argv[08]="userdata,size=0x4200000,file=C:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avd/userdata-qemu.img"emulator:argv[09]="-nand"emulator:argv[10]="cache,size=0x4200000,file=C:\DocumentsandSettings\lizhongyi\.android\avd\avd2.avd/cache.img"emulator:argv[11]="-serial"emulator:argv[12]="android-kmsg"emulator:argv[13]="-serial"emulator:argv[14]="android-qemud"emulator:argv[15]="-append"emulator:argv[16]="qemu=1console=ttyS0android.checkjni=1android.qemud=ttyS1android.nd
ns=1"emulator:argv[17]="-m"emulator:argv[18]="96"emulator:mapping'system'NANDimagetoC:\DOCUME~1\LIZHON~1\LOCALS~1\Temp\\AndroidEmulator\TMP834.tmpemulator:using'winaudio'audioinputbackendemulator:using'winaudio'audiooutputbackendemulator:controlconsolelisteningonport5556,ADBonport5557emulator:sent'0012host:emulator:5557'toADBserveremulator:pingprogram:E:\android_sdk\android-sdk-windows-1.6_r1\tools\ddms.batemulator:pingcommand:C:\WINDOWS\system32\cmd.exe/C"E:\android_sdk\android-sdk-windows-1.6_r1\tools\ddms.bat"pingemulator1.11(6)使用-logcat选项emulator-logcatmain-avdavd2(7)使用-trace选项E:\android_sdk\android-sdk-windows-1.6_r1\tools>emulator-tracemain(或events,或radio)-avdavd2--Whendonetracing,exittheemulator.-emulator:emulatorwindowwasoutofviewandwasrecentred或者:E:\android_sdk\android-sdk-windows-1.6_r1\tools>emulator-traceradio-trace
main-traceradio-avdavd2(8)使用-kernel和-ramdisk选项E:\android_sdk\android-sdk-windows-1.6_r1\tools>emulator-kernel..\platforms\android-1.6\images\kernel-qemu-ramdisk..\platforms\android-1.6\images\ramdisk.img-debug-kernel-verbose-avdavd2(9)使用-netfast选项E:\android_sdk\android-sdk-windows-1.6_r1\tools>emulator-netfast-avdavd22.2使用模拟器控制台每一个运行中的模拟器实例都包括一个控制台,你可以利用控制台动态的
查询和控制模拟设备的环境。例如,你可以利用控制台动态的管理端口映射和网络特性,还可以模拟电话时间。要想进入控制台输入命令,你需要使用telnet连接到控制台的端口号。可以使用下面的命令随时随地连接到任何一个运行中的模拟器实例:telnetlocalhost端口号假设第一个模拟器实例的控制台使用5554端口,下一个实例使用的端口号会加2,比如5556、5558……等。你可以在启动模拟器是使用-verbose选项来检测该模拟器实例使用的端口号,在调试输出的找到以”emulatorconsolerunningonportnumber”这一行。另外,你可以在命令行中使用adbdevices来查看模拟器实例和他们的端口列表。最多可以有16个模拟器实例同时运行控制台。(1)进入控制台先在一个cmd窗口中启动一个模拟器,再打开一个cmd窗口,运行telnet命令,如下:E:\android_sdk\android-sdk-windows-1.6_r1\tools>telnetlocalhost5556(因为在我的PC上,启动了两个模拟器,一个用的是5554端口,另一个用的是5556端口.这里,控制的是使用5556端口的模拟器)进入后,如下图:(2)输入gsmvoiceonok则可以在模拟器上看到3G图标,并且网络图标处于有信号状态。而执行gsmvoiceoffok后,3G图标消失,并且网络图标处于关闭(X)状态。gsmcall13522543026ok后,模拟器有如下反应:GSM测试
(3)
sms测试
smssend135225430
26hellook则,在模拟器的messaging中,就会看到有一条短信了.
编辑本段回目录3
ddms.bat
3.1
直接启动ddms
E:\android_sdk\android-sdk-windows-1.6_r1\tools>ddms02:30I/ddms:Created:[Debugger8600-->568inactive]02:30I/ddms:Created:[Debugger8601-->617inactive]02:30I/ddms:Created:[Debugger8602-->619inactive]02:30I/ddms:Created:[Debugger8603-->657inactive]02:30I/ddms:Created:[Debugger8604-->670inactive]02:30I/ddms:Created:[Debugger8605-->681inactive]这和eclipse中的ddms是一样的.4adbAdbhelp:
1.14.1
直接运行adb会显示出adb的help信息.如下:E:\android_sdk\android-sdk-windows-1.6_r1\tools>adb-helpAndroidDebugBridgeversion1.0.22-dpresent.-erunning.-s
-p-directscommandtotheUSBdeviceoremulatorwiththegivenserialnumber-simpleproductnamelike'sooner',orarelative/absolutepathtoaproductoutdirectorylike'out/target/product/sooner'.If-pisnotspecified,theANDROID_PRODUCT_OUTenvironmentvariableisused,whichmustbeanabsolutepath.devices-listallconnecteddevices-directscommandtotheonlyrunningemulator.returnsanerrorifmorethanoneemulatoris-directscommandtotheonlyconnectedUSBdevicereturnsanerrorifmorethanoneUSBdeviceis
devicecommands:adbpushadbpulladbsync[]adbshelladbshelladbemu-copyfile/dirtodevice-copyfile/dirfromdevice-copyhost->deviceonlyifchanged(see'adbhelpall')-runremoteshellinteractively-runremoteshellcommand-runemulatorconsolecommand
adblogcat[]-Viewdevicelogadbforward-forwardsocketconnectionsforwardspecsareoneof:tcp:localabstract:localreserved:localfilesystem:dev:jdwp:(remoteonly)adbjdwp-listPIDsofprocesseshostingaJDWPtransport('-l'meansforward-locktheapp)('-r'meansreinstalltheapp,keepingitsdata)adbuninstall[-k]-removethisapppackagefromthedevice('-k'meanskeepthedataandcachedirectories)adbbugreportadbhelpadbversionDATAOPTS:(nooption)-w-dscripting:adbwait-for-deviceadbstart-serveradbkill-serveradbget-stateadbget-serialnoadbstatus-window-blockuntildeviceisonline-ensurethatthereisaserverrunning-killtheserverifitisrunning-prints:offline|bootloader|device-prints:-continuouslyprintdevicestatusforaspecified-don'ttouchthedatapartition-wipethedatapartition-flashthedatapartition-returnallinformationfromthedevicethatshouldbeincludedinabugreport.-showthishelpmessage-showversionnumadbinstall[-l][-r]-pushthispackagefiletothedeviceandinstallit
deviceadbremountread
-writeadbreboot[bootloader|recovery]-rebootsthedevice,optionallyintothebootloaderorrecoveryprogramadbrootnetworking:adbppp[parameters]-RunPPPoverUSB.Note:youshouldnotautomaticallystartaPPPconnection.referstothettyforPPPstream.Eg.dev:/dev/omap_csmi_tty1[parameters]-Eg.defaultroutedebugdumplocalnottyusepeerdnsadbsyncnotes:adbsync[]canbeinterpretedinseveralways:-Ifisnotspecified,both/systemand/datapartitionswillbeupdated.14.2Ifitis"system"or"data",onlythecorrespondingpartitionisupdated.scripting:(1)startadbserver方法1:E:\android_sdk\android-sdk-windows-1.6_r1\tools>adbkill-serverE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbstart-server*daemonnotrunning.startingitnow**daemonstartedsuccessfully*E:\android_sdk\android-sdk-windows-1.6_r1\tools>方法2:E:\android_sdk\android-sdk-windows-1.6_r1\tools>adbkill-serverE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbfork-serverserverOK注意:方法1是直接用adb的scripting“adbstart-server”来启动的,启动成功后,直接返回到cmd命令窗口;方法2是用直接启动adbserver进程的方式”adbfork-serverserver”来启动的,启动成功后,显示”OK”,并且不返回到cmd命令窗口.分析:这是因为adb.exe是一个命令(可执行程序),它启动后,会调用到”adbfork-serverserver”(这个server正是adbserver),然后,adb.exe就退出了,这时,只剩下adbserver这个进程了,这个进程的名字也是adb.exe.而方法2是直接启动adbserver,所以,不能退出,如果退出,就相当于adbserver退出了.adbserver启动后,会在任务管理器中进程中可以看到adb.exe.如果用户将adb.exe强行结束了,那么,对于方法2,就会回到cmd窗口.另外,如果eclipse中启动了模拟器,那么,强行结束adbserver后,会再启动一个.-restartsadbwithrootpermissions-remountsthe/systempartitiononthedevice
(2)adbget-stateandget-serialnoE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbget-statedeviceE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbget-serialnoemulator-5554如果同时启动了两个模拟器,则这两个脚本的执行结果均是:unknown(3)adbrootE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbrootadbdisalreadyrunningasrootadbrebootrecovery(4)adbreboot[android-sdk-windows-1.6_r1支持]adbrebootbootloader(或recovery)说明:rebootsthedevice,optionallyintothebootloaderorrecoveryprogram,可见,只针对真机,所以,当运行此脚本时,模拟器就不能运行了。另外,此脚本是从android-sdk-windows-1.6_r1开始支持的。1.12.3devicecommands:
(1)listallconnecteddevicesE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbdevicesListofdevicesattachedemulator-5554emulator-5556(2)adbshell开
机:E:\android_sdk\android-sdk-windows-1.6_r1\tools>adbshell#lslssqlite_stmt_journalscachesdcardetcsystemsyssbinprocinit.rcinit.goldfish.rcdevicedevice
initdefault.propdatarootdev#cddatacddata#lslsmisclocaldataapp-privateapppropertyanrdalvik-cachesystemlost+found#cddatacddata#pwdpwd/data/data#ls-lLs-l#ls-lls-ldrwxr-xr-xapp_0drwxr-xr-xapp_1drwxr-xr-xapp_2drwxr-xr-xapp_1drwxr-xr-xapp_3drwxr-xr-xapp_4app_0app_1app_2app_1app_3app_42009-11-2502:422009-11-2502:422009-11-2502:42com.android.fallback2009-11-2502:422009-11-2502:422009-11-2502:42com.android.packageinstallercom.android.providers.contacts
com.android.inputmethod.latincom.android.gesture.builder
com.google.android.marvin.talkbackdrwxr-xr-xapp_5drwxr-xr-xapp_1drwxr-xr-xsystemdrwxr-xr-xapp_6com.android.developmentdrwxr-xr-xapp_7drwxr-xr-xapp_8drwxr-xr-xapp_1com.android.globalsearchdrwxr-xr-xapp_9jp.co.omronsoft.openwnndrwxr-xr-xapp_10drwxr-xr-xapp_5drwxr-xr-xapp_11drwxr-xr-xsystemdrwxr-xr-xapp_12com.android.browserdrwxr-xr-xapp_13drwxr-xr-xapp_14com.android.customlocaledrwxr-xr-xapp_1drwxr-xr-xapp_15drwxr-xr-xapp_16com.android.netspeeddrwxr-xr-xradiodrwxr-xr-xapp_1drwxr-xr-xapp_17com.android.htmlviewerdrwxr-xr-xsystemcom.android.server.vpndrwxr-xr-xapp_1app_12009-11-2502:43com.google.android.providers.enhancedgooglesearchsystem2009-11-2502:43radioapp_1app_172009-11-2502:43com.android.phone2009-11-2502:43com.android.contacts2009-11-2502:43app_1app_15app_162009-11-2502:422009-11-2502:422009-11-2502:42com.android.providers.userdictionarycom.android.soundrecorderapp_13app_142009-11-2502:42android.tts2009-11-2502:42app_10app_5app_11systemapp_122009-11-2502:42com.android.mms2009-11-2502:42com.android.camera2009-11-2502:42com.android.term2009-11-2502:42com.android.settings2009-11-2502:42app_92009-11-2502:42app_7app_8app_12009-11-2502:42com.android.email2009-11-2502:42com.android.music2009-11-2502:42app_5app_1systemapp_62009-11-2502:422009-11-2502:422009-11-2502:422009-11-2502:42com.android.providers.downloadscom.android.inputmethod.pinyincom.android.providers.settings
drwxr-xr-xapp_18com.android.sdksetupdrwxr-xr-xapp_4drwxr-xr-xapp_5drwxr-xr-xapp_1drwxr-xr-xapp_1drwxr-xr-xapp_19drwxr-xr-xapp_5drwxr-xr-xapp_20com.android.calculator2drwxr-xr-xapp_4drwxr-xr-xradiodrwxr-xr-xapp_21com.android.alarmclockdrwxr-xr-xapp_22com.android.spare_parts
app_18app_4app_5app_1app_1app_19app_5app_20app_4radioapp_21app_22
2009-11-2502:432009-11-2502:432009-11-2502:432009-11-2502:43com.android.launcher2009-11-2502:432009-11-2502:43com.svox.pico2009-11-2502:432009-11-2502:432009-11-2502:432009-11-2502:432009-11-2502:432009-11-2502:43
com.google.android.marvin.soundbackcom.android.providers.drm
com.android.providers.applicat
ions
com.android.providers.media
com.google.android.marvin.kickbackcom.android.providers.telephony
先后启动kx011和a两个应用程序(都是activity),则,在/data/data下,就会看到如下两个应用了,#lsa.acom.kx011而且,在/data/app下,也有这两个应用的apk文件。#cd/data/appcd/data/app#lslscom.kx011.apka.a.apk说明:在/data/data目录下,存放了所有系统已经启动的的应用程序;在/data/app下,以apk的形式存放了用户建立的应用。(3)adbpull//说明:copyfile/dirfromdevice
E:\android_sdk\android-sdk-windows-1.6_r1\tools>adbpull/init.rc
F:\ABD\x.txt668KB/s(10700bytesin0.015s)adbpushadbpull-copyfile/dirtodevice-copyfile/dirfromdevice
(4)adbpush//说明:copyfile/dirtodeviceE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbpushddms.bat/data/124KB/s(1992bytesin0.015s)(5)adbinstallE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbinstallD:\allProject\android16\kx011\bin\kx011.apk259KB/s(8297bytesin0.031s)pkg:/data/local/tmp/kx011.apkSuccess#说明:install完成之后,直接进入adbshell(6)adbjdwpE:\android_sdk\android-sdk-windows-1.6_r1\tools>adbjdwp567614616641661678707714(7)adbbugreport列出了bug信息,seetobugreport.txt13关于编译am:[点击查看]
1.13.1
adbinstallc:\NetScramble_1.1.apkadbshellrmdata/app/NetScramble_1.1.apkamstart-nnet.xiashou.android/net.xiashou.android.HelloAndroid#amstart-aandroid.intent.action.VIEW-dxiashou.NET#amstart-aandroid.intent.action.CALL-dtel:10086#amstart-aandroid.intent.action.VIEWgeo:0,0?q=tianjin#amstart–ncom.android.music/.MediaPlaybackActivity1.13.2重新编译源码当然,这是在linux下面进行的。
(1)编译源码解压原码到本地,进入原码目录,执行:make,即可。(2)编译SDK在make完成后,直接makesdk,会在out/host/linux-x86/sdk下面生成mdk文件及文件夹,形如:android-sdk_eng.xxx_linux-x86(3)编译单个模块1.先将system文件夹移出,2.在android目录下执行$.build/envsetup.sh3.然后你就会多出几个可用的命令。在改了Contacts联系人项目后,可以简单的执行一下命令来单独编译这个部分:$mmmpackages/apps/Contacts/或者在src目录下直接运行makemodulename:cd~/android/srcmakeContacts4.将新生成的system文件夹覆盖原system文件夹5.然后编译system.img./out/host/linux-x86/bin/mkyaffs2image-fout/target/product/generic/systemout/target/product/generic/system.img第二次mmm需将/out/target/product/generic/obj/全部拷回!!!(mmm命令非常的多管闲事,它每次编译都把obj删了!!!)输出cmd命令到文件dir>a.log
编辑本段回目录4
系统信息
由于篇幅的原因,这里,只给出链接,分别
列出了process,memoryinfo,initlog,bugreport信息。值得注意的是,bugreport中包含了前三项。另外,process和memoryinfo是从真机中导出来的,initlog和bugreport是从模拟器拿到的,而且,取得的日期时间都不一致。process,memoryinfo,initlog,bugreport