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

总结了下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内核编绎错误解决方案


四.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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/22664.html