• android
  • ddms
  • monitor
  • draw9patch
  • emulator
  • hierachyviewer
  • jobb
  • lint
  • mksdcard
  • mokeyrunner
  • screenshot2
  • traceview
  • uiautomatorviewwe

android

android核心工具,包括实现Android SDK Manager,AVD的所有功能,以及可以通过它创建一个android工程等等,命令格式为./android [global options] action [action options]可以在tools目录下输入./android -h查看命令提示,如下:

caihaifei@hfcai:/opt/android-sdk-linux/tools$ ./android -h

       Usage:
android [global options] action [action options]
Global options:
-s --silent : Silent mode, shows errors only.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-h --help : Help on a specific command. Valid
actions
are
composed
of a verb
and an
optional
direct
object:
- sdk : Displays the SDK Manager window.
- avd : Displays the AVD Manager window.
- list : Lists existing targets or virtual devices.
- list avd : Lists existing Android Virtual Devices.
- list target : Lists existing targets.
- list device : Lists existing devices.
- list sdk : Lists remote SDK repository.
- create avd : Creates a new Android Virtual Device.
- move avd : Moves or renames an Android Virtual Device.
- delete avd : Deletes an Android Virtual Device.
- update avd : Updates an Android Virtual Device to match the folders
of a new SDK.
- create project : Creates a new Android project.
- update project : Updates an Android project (must already have an
AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must
already have an AndroidManifest.xml).
- create lib-project : Creates a new Android library project.
- update lib-project : Updates an Android library project (must already have
an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb : Updates adb to support the USB devices declared in the
SDK add-ons.
- update sdk : Updates the SDK by suggesting new platforms to install
if available.

介绍几个可以常用的功能:

1)打开Android SDK Manager工具并捕获它的所有log信息

   $:./android -v sdk

2) 删除名字叫test的avd(即android虚拟模拟器),你可以通过./android list avd查看你所有的avd信息**

    $:./android -s delete avd -n test

3)新建一个工程,首先可以先看一下创建工程需要提供的参数有那些:

     Creates a new Android project.
Options:
-n --name : Project name.
-a --activity : Name of the default Activity that is created.
[required]
-k --package : Android package name for the application. [required]
-v --gradle-version: Gradle Android plugin version.
-t --target : Target ID of the new project. [required]
-g --gradle : Use gradle template.
-p --path : The new project's directory. [required]

如上,我们可以通过如下命令创建一个工程:

$:./android -n TestProject -a MainActivity -k com.hfcai.test -t 10 -p ~/Desktop/TestProject

该命令会创建一个非gradle工程,eclipse的标准目录结构,如果需要创建一个gradle构建的android工程,命令如下:

$:./android -n TestProject -a MainActivity -k com.hfcai.test -t 10 -v 3.1 -g ~/Desktop/TestProject

android更加详细的命令介绍:https://developer.android.com/studio/tools/help/android.html


Monitor,DDMS

draw9patch


hierachyviewer


jobb

jobb [-d <directory>][-o <filename>][-pn <package>][-pv <version>] \
[-k <key>][-ov][-dump <filename>][-v][-about]

android官方文檔給我們了一個命令示例,加密命令如:

$ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11

提取转存命令:

$ jobb -d /temp/obb-output/ -o my-app-assets.obb -k secret-key

lint

Android SDK自带调试优化工具-LMLPHP

  • App Source Files:应用程序原文件
  • lint.xml:过滤lint检查类型
  • lint Tool:lint检查工具,即toosl目录下的lint

lint的结果信息会在命令控制台显示,手动开启lint检测的命令格式如下:

lint [flags] <project directory>

在gradle项目中可以使用 gradlew lint 或者 gradle lint,默认会将结果生成一个html文件和一个xml文件,默认位置在build/outputs/lint-results-app_版本名.html和在build/outputs/lint-results-app_版本名.xml文件,html显示如下:

Android SDK自带调试优化工具-LMLPHP

lint自定义配置就不再详叙了,请参考官网文档:https://developer.android.com/studio/write/lint.html#commandline


由于篇幅原因,其余工具接下一篇。

05-11 13:02