大家可能對(duì)于Android這一手機(jī)操作系統(tǒng)有所了解,因?yàn)槭忻嫔虾芏嘀悄苁謾C(jī)都開始采用這一系統(tǒng)來(lái)抓住商業(yè)機(jī)遇。通過(guò)對(duì)它的深入了解,可以知道,adb是Android重要工具之一,以提供強(qiáng)大的特性,例如復(fù)制文件到設(shè)備或從設(shè)備復(fù)制文件??梢允褂肁ndroid Shell命令行參數(shù)連接到手機(jī)本身,并發(fā)送基本的 shell 命令。
進(jìn)入命令行,使用
進(jìn)入到Android Shell命令模式,注意,這時(shí)候模擬器或者手機(jī)要啟用并且正確接通。
在這個(gè)Android Shell命令環(huán)境中,可以: 顯示網(wǎng)絡(luò)配置,網(wǎng)絡(luò)配置可顯示多個(gè)網(wǎng)絡(luò)連接。注意這多個(gè)網(wǎng)絡(luò)連接: lo 是本地或 loopback 連接。 tiwlan0 是 WiFi 連接,該連接由本地 DHCP 服務(wù)器提供一個(gè)地址。 顯示 PATH 環(huán)境變量的內(nèi)容。 執(zhí)行 su 命令,以成為超級(jí)用戶。 將目錄改為 /data/app,其中存放用戶應(yīng)用程序。 列出包含某個(gè)應(yīng)用程序的目錄。Android 應(yīng)用程序文件實(shí)際上是歸檔文件,可通過(guò) WinZip 之類的軟件查看。擴(kuò)展名為 apk。 從相同的命令提示符環(huán)境中,還可以與 SQLite 數(shù)據(jù)庫(kù)交互,啟動(dòng)程序以及執(zhí)行許多其他系統(tǒng)級(jí)任務(wù)。想像一下您正在連接到電話,因此這是非常了不起的功能。
一、adb命令
二、Android Shell命令
通過(guò)adb shell命令進(jìn)入shell后,執(zhí)行下列命令。
1、訪問(wèn)數(shù)據(jù)庫(kù):
2、記錄無(wú)線通訊日志: 一般來(lái)說(shuō),無(wú)線通訊的日志非常多,在運(yùn)行時(shí)沒(méi)必要去記錄,但我們還是可以通過(guò)命令,設(shè)置記錄:
3、刪除應(yīng)用: Android沒(méi)有提供一個(gè)卸載應(yīng)用的命令,需要自己手動(dòng)刪除:
注:[appName]為應(yīng)用的名稱;
三、可以在Android Shell命令下使用的一些linux命令 命令:
Android Shell命令的相關(guān)內(nèi)容就為大家介紹到這里。 命令行工具ADB(Andvoid Debug Bridge)是Android提供的一個(gè)通用的調(diào)試工具,借助這個(gè)工具,我們可以管理設(shè)備或手機(jī)模擬器的狀態(tài)。51Testing軟件測(cè)試網(wǎng) r2n3lWI3] adb help51Testing軟件測(cè)試網(wǎng)_\Z Pw -d - directs command to the only
connected USB device returns an error
if more than one USB device is present. -e -
directs command to the only running
emulator. returns
an error if more than one emulator is
running. -s <serial
number> - directs command to the USB device or emulator
with the given serial
number -p <product name or
path> - simple product name like 'sooner',
or a
relative/absolute path to a product out
directory like
'out/target/product/sooner'. If -p is not
specified, the ANDROID_PRODUCT_OUT environment
variable is used, which must be an absolute
path. devices - list
all connected devices device commands: adb push <local>
<remote> - copy file/dir to
device adb pull <remote>
<local> - copy file/dir from
device adb sync [ <directory>
] - copy host->device only if
changed (see 'adb
help all') adb shell -
run remote shell interactively adb shell
<command> - run remote shell
command adb emu
<command> - run emulator console
command adb logcat [ <filter-spec> ] - View
device log adb forward <local> <remote> -
forward socket connections forward
specs are one of: tcp:<port> localabstract:<unix
domain socket name> localreserved:<unix
domain socket name> localfilesystem:<unix
domain socket name> dev:<character
device name> jdwp:<process
pid> (remote only) adb jdwp -
list PIDs of processes hosting a JDWP
transport adb install [-l] [-r] <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) adb uninstall [-k] <package> - remove
this app package from the device ('-k' means
keep the data and cache directories) adb bugreport -
return all information from the device that should
be included in a bug report. adb help -
show this help message adb version -
show version num DATAOPTS: (no option) -
don't touch the data partition -w -
wipe the data partition -d -
flash the data partition scripting: adb wait-for-device -
block until device is online adb start-server -
ensure that there is a server running adb kill-server -
kill the server if it is running adb get-state -
prints: offline | bootloader | device adb get-product -
prints: <product-id> adb get-serialno -
prints: <serial-number> adb status-window -
continuously print device status for a specified
device adb remount -
remounts the /system partition on the device
read-write networking: adb ppp <tty>
[parameters] - Run PPP over
USB. Note: you should not automatically start a
PDP connection. <tty> refers to the tty for PPP
stream. Eg. dev:/dev/omap_csmi_tty1 [parameters] - Eg. defaultroute debug dump
local notty usepeerdns adb sync notes: adb sync [ <directory>
] <localdir> can be interpreted in
several ways: - If <directory> is not specified,
both /system and /data partitions will be
updated. - If it is "system" or "data", only the
corresponding partition is
updated. 1、快速更新設(shè)備或手機(jī)模擬器中的代碼,如應(yīng)用或Android系統(tǒng)升級(jí); 2、在設(shè)備上運(yùn)行shell命令; 3、管理設(shè)備或手機(jī)模擬器上的預(yù)定端口; 4、在設(shè)備或手機(jī)模擬器上復(fù)制或粘貼文件; 5、安裝.apk文件到仿真器上。 以下為一些常用的操作: 1、安裝應(yīng)用到模擬器: adb install 比較郁悶的是,Android并沒(méi)有提供一個(gè)卸載應(yīng)用的命令,只能自己手動(dòng)刪除: adb shell cd /data/app rm app.apk 2、進(jìn)入設(shè)備或模擬器的shell: adb shell 通過(guò)上面的命令,就可以進(jìn)入設(shè)備或模擬器的shell環(huán)境中,在這個(gè)Linux Shell中,你可以執(zhí)行各種Linux的命令,另外如果只想執(zhí)行一條shell命令,可以采用以下的方式: adb shell [command] 如:adb shell dmesg會(huì)打印出內(nèi)核的調(diào)試信息。 3、發(fā)布端口: 你可以設(shè)置任意的端口號(hào),做為主機(jī)向模擬器或設(shè)備的請(qǐng)求端口。如: adb forward tcp:5555
tcp:8000 4、復(fù)制文件: 你可向一個(gè)設(shè)備或從一個(gè)設(shè)備中復(fù)制文件, 復(fù)制一個(gè)文件或目錄到設(shè)備或模擬器上: adb push 如:adb push test.txt
/tmp/test.txt 從設(shè)備或模擬器上復(fù)制一個(gè)文件或目錄: adb pull 如:adb pull /addroid/lib/libwebcore.so
. 5、搜索模擬器/設(shè)備的實(shí)例: 取得當(dāng)前運(yùn)行的模擬器/設(shè)備的實(shí)例的列表及每個(gè)實(shí)例的狀態(tài): adb devices 6、查看bug報(bào)告: adb bugreport 7、記錄無(wú)線通訊日志: 一般來(lái)說(shuō),無(wú)線通訊的日志非常多,在運(yùn)行時(shí)沒(méi)必要去記錄,但我們還是可以通過(guò)命令,設(shè)置記錄: adb shell logcat -b radio 8、獲取設(shè)備的ID和序列號(hào): adb get-product adb get-serialno 9、訪問(wèn)數(shù)據(jù)庫(kù)SQLite3 adb shell sqlite3 安卓網(wǎng)的一個(gè)帖子,寫得不錯(cuò),記下來(lái) ADB全稱Android Debug Bridge,
是android sdk里的一個(gè)工具, 用這個(gè)工具可以直接操作管理android模擬器或者真實(shí)的andriod設(shè)備(如G1手機(jī)). ADB常用的幾個(gè)命令 這個(gè)命令是查看當(dāng)前連接的設(shè)備, 連接到計(jì)算機(jī)的android設(shè)備或者模擬器將會(huì)列出顯示 這個(gè)命令將指定的apk文件安裝到設(shè)備上 3. 卸載軟件 如果加 -k 參數(shù),為卸載軟件但是保留配置和緩存文件. 這個(gè)命令將登錄設(shè)備的shell. 用push命令可以把本機(jī)電腦上的文件或者文件夾復(fù)制到設(shè)備(手機(jī)) 用pull命令可以把設(shè)備(手機(jī))上的文件或者文件夾復(fù)制到本機(jī)電腦 這個(gè)命令將顯示幫助信息 刪除Android系統(tǒng)Rom自帶的軟件 Android系統(tǒng)沒(méi)有卸載Rom自帶軟件的功能.可能有些同學(xué)很想刪除廢了武功的Youtube,想刪除墻那邊的Twitter. 加上Android的快捷方式?jīng)]法修改沒(méi)法自己排序沒(méi)法分頁(yè). 安裝的程序太多就會(huì)發(fā)現(xiàn)原來(lái)找到自己想要的東西很難. 綜上所述,我覺(jué)得告知各位菜鳥同學(xué)如何刪除自帶的程序是很有必要的一件事情. 1.確定手機(jī)root了,取得了root權(quán)限才能刪除系統(tǒng)文件呀. 2.下載Android_db.rar,解壓到%windir/%System32下. 3.手機(jī)連接數(shù)據(jù)線,在電腦上打開cmd,然后輸入命令 adb remount adb shell su 執(zhí)行完成之后,你會(huì)看到: * daemon not running. starting it now * * daemon started successfully * 4.接著就是Linux命令行模式了,輸入 cd system/app 你會(huì)發(fā)現(xiàn)沒(méi)啥變化,然后輸入ls回車. 這時(shí)候列表顯示了system/app里面的所有文件,也就是Rom集成的一些軟件了. 5.開始刪除吧.比如刪除Youtube,他的文件名是Youtube.odex和Youtube.apk 我們要?jiǎng)h除這2個(gè)文件,敲入以下命令: rm Youtube.* 重啟,Youtube已經(jīng)刪除掉了,注意各位同學(xué)千萬(wàn)不要?jiǎng)h除你不知道是啥的東西. 原文鏈接: http://www./bbs/thread-623-1-1.html 指定允許AVD的內(nèi)存大?。?/p>
emulator -avd avdName -partition-size 256 啟動(dòng)一個(gè)叫avdName的模擬器,允許內(nèi)存最大為256M |
|
來(lái)自: jiayongmao > 《android》