歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux環境下Android常用工具和技巧

Linux環境下Android常用工具和技巧

日期:2017/2/28 15:58:16   编辑:Linux教程
總結了下Linux環境下Android常用工具和技巧。一方面鞏固復習之前的知識,另一方面共享出來,這裡工具和技巧可能會對大家有用。

一.終端
1.新建終端 ctrl-alt-t
2.創建新終端窗口 ctrl-shift-t

二.安裝/更新軟件
$sudo apt-cache search xxx 搜索包含xxx的軟件

$sudo apt-get update 更新源

$sudo apt-get upgrade 升級軟件

$sudo apt-get install(remove/autoremove) xxx 安裝(卸載/自動卸載) xxx軟件

$sudo rm /var/lib/apt/lists/lock 釋放apt-get鎖

三.編譯
1.編譯源碼
$cd source code path
$. source code path/build/envsetup.h
$make

2.編譯工程
$cd source code path
$. source code path/build/envsetup.h
$cd project path
$mm

3.64位系統 Android內核編繹錯誤解決方案
http://blog.csdn.net/zyc13701469860/archive/2011/02/25/6207522.aspx

四.ADB
1.adb命令
adb push <local> <remote> - copy file/dir to device

adb pull <remote> [<local>] - copy file/dir from device

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 install [-l] [-r] [-s] <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)

adb uninstall [-k] <package> - remove this app package from the device

('-k' means keep the data and cache directories)

adb start-server - ensure that there is a server running

adb kill-server - kill the server if it is running

adb devices -restart device

2.如果device斷開可用以下方法重啟
sudo adb kill-server
sudo adb devices

3.終端啟動模擬器
$sudo cp android SDK path/tools/emulator /usr/bin/
$emulator -avd avdname [參數1|參數2|...]
$android-sdk-linux_x86/tools/emulator -avd avd4.0 -partition-size 1024 -sdcard mysdcard.iso"

4.在adb push時,發生以下情況:
1.out of memory --內存不足,終端啟動模擬器加上 -partition-size xxx參數,xxx為內存大小(MB)
2.read-only --模擬器文件夾只讀,使用 $sudo adb remount
3.not found device 同device斷開重啟方法

5.在終端顯示模擬器/真機的log
$adb logcat --一般顯示
$adb logcat -v time --輸出時間
$adb logcat -v time|grep "xxx" --輸出時間和含有字串xxx的log

6.64位系統啟動android 3.0模擬器
需要安裝$sudo apt-get ia32-libs

五.xp虛擬機無法啟動解決方法
$sudo invoke-rcid virtualbox-ose stop
$sudo invoke-rcid virtualbox-ose start

Copyright © Linux教程網 All Rights Reserved