ADB命令
Application Exerciser Monkey
Gradle
ProGuard
代码重用
版本控制
静态代码分析
代码重构
开发者模式
 

ADB命令:

@、adb help:查看adb命令。

@、adb devices:列出所有连接的安卓设备和模拟器。

@、adb push <local> <remote> 把计算机里的文件拷贝到设备中。

adb push e:\test.xml /sdcard/files.ldb/

@、adb pull <remote> <local> 把设备中的文件拷贝到计算机里

@、adb devices:可以查看连接设备的序列号(serial number)

@、adb {–s <serial number>} logcat

@、adb logcat <tag>:<priority>

举例:

在自定义类中定义一个日志标签,如:

private static final String LOG_TAG = “MyActivity”;

然后在此自定义类中的代码中使用此标签记录日志,如:

Log.d(LOG_TAG, “adb logcat test”);

这样就可以在命令行中使用MyActivity这个标签进行日志过滤,命令格式:

adb logcat MyActivity:* *:S

注:*:S不能少,*:S表示让logcat不展示其它日志(原文:*:S,which tells logcat to silence all messages.)。

@、使用adb命令,实现通过Wifi连接设备。注:安卓设备与计算机使用同一Wifi。

1、  首先使用USB连接设备与计算机;

2、  在命令行中输入以下命令

adb devices //确认下连接的设备,可以看到序列号。

adb tcpip 5555  //以TCP/IP模式重启设备的adb进程,并监听5555端口(adb默认端口)

adb connect <IP>  //通知计算机的adb Service 连接 IP 地址,其中IP为设备的IP。

adb devices //再次确认连接的设备,此时可看到一个<IP>:5555 的设备。

3、  这样拔掉USB线后,依然可以使用此设备进行调试。

4、  当重启设备,或者使用 adb usb 命令,设备的adb进程又恢复USB模式。

@、adb shell 可以对设备使用命令行操作,类似于在Linux上操作一样。

@、adb shell am <options> 可以启动设备上的Service,Intent等。

@、adb shell pm <options> 可以对设备中的功能,权限进行查看、安装等操作。

具体了解adb命令,可查看http://developer.android.com/tools/help/adb.html

Application Exerciser Monkey:

@、一个命令行工具,能够通过生成伪随机事件来模拟用户操作对应用进行stress test。

@、命令:adb shell monkey –p <package name> <event count>

@、通过Monkeyrunner进行regression testing。You can find the API for the Monkeyrunner at http://developer.android.com/tools/help/monkeyrunner_concepts.html#APIClasses

Gradle:

The user guide for the new Gradle build system can be found at

http://tools.android.com/tech-docs/new-build-system/user-guide

ProGuard:

@、一个集成在Android SDK的工具,在发布应用时,可用此工具打乱代码(obfuscate your code),这样可增加应用被反编译的难度。使用方法:在build.gradle文件中添加:

buildTypes {

release {

runProguard true

proguardFile getDefaultProguardFile(‘proguard-android.txt’)

}

}

@、可以优化代码,去除无用的代码,减小发布应用的大小。

代码重用:

@、使用JAR包,一般用于引用第三方的代码。使用方法:把JAR包拷贝到libs目录下,然后再build.gradle文件中添加:

dependencies{

compile files(‘libs/XXX.jar’) // XXX为要引用的JAR包名称。

}

@、使用library project,常用于一个工程里的多个应用,服务端和客户端等之间共享一些工具类,通用视图等。使用方法,在工程中新建一个module,类型选择Android Library;然后在其它模块的build.gradle文件中添加:

dependencies{

compile project(‘:libraries:XXX’) // XXX为创建的library project的名称。

}

版本控制:

@、git:

1、  https://git-scm.com/

2、  Version Control with Git 一本介绍git的书。

@、创建自己的gitolite服务器,这样就可以远程访问Git respositories。

You can find the documentation and download for gitolite at

http://gitolite.com/gitolite

An excellent quick installation guide can be found at

http://gitolite.com/gitolite/qi.html

@、使用现成的服务器,比如GitHub http://github.com

@、代码检查工具Gerrit

You can find out more about Gerrit and download the server at

https://code.google.com/p/gerrit (新地址:https://www.gerritcodereview.com/)

静态代码分析:

@、使用Android SDK自带的lint工具进行代码分析。使用方法:在Android Studio的project视图中,右键 >> Analyze >> Inspect Code…

代码重构:

@、通过Refactor功能,实现静态变量提取,方法提取,方法签名变化等功能。详细信息请查看:http://www.jetbrains.com/idea/features/refactoring.html

开发者模式:

@、Android 4.2及以后版本系统,开发人员菜单被隐藏,开启方法:进入“关于手机” >> “版本号(Build Number)”点击7次 >> 返回上一层,可看到开发人员菜单。

Android Programming: Pushing the Limits -- Chapter 1: Fine-Tuning Your Development Environment的更多相关文章

  1. Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- ApiWrapper

    前面两片文章讲解了通过AIDL和Messenger两种方式实现Android IPC.而本文所讲的并不是第三种IPC方式,而是对前面两种方式进行封装,这样我们就不用直接把Aidl文件,java文件拷贝 ...

  2. Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- Messenger

    Messenger类实际是对Aidl方式的一层封装.本文只是对如何在Service中使用Messenger类实现与客户端的通信进行讲解,对Messenger的底层不做说明.阅读Android Prog ...

  3. Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- AIDL

    服务端: 最终项目结构: 这个项目中,我们将用到自定义类CustomData作为服务端与客户端传递的数据. Step 1:创建CustomData类 package com.ldb.android.e ...

  4. Android Programming: Pushing the Limits -- Chapter 5: Android User Interface Operations

    多屏幕 自定义View 多屏幕 @.Android 4.2 开始支持多屏幕. @.举例: public class SecondDisplayDemo extends Activity { priva ...

  5. Android Programming: Pushing the Limits -- Chapter 4: Android User Experience and Interface Design

    User Stories Android UI Design 附加资源 User Stories: @.通过写故事来设计应用. @.每个故事只关注一件事. @.不同的故事可能使用相同的组件,因此尽早地 ...

  6. Android Programming: Pushing the Limits -- Chapter 3: Components, Manifests, and Resources

    Android Components Manifest文件 Resource and Assets v\:* {behavior:url(#default#VML);} o\:* {behavior: ...

  7. Android Programming: Pushing the Limits -- Chapter 2: Efficient Java Code for Android

    Android's Dalvik Java 与 Java SE 进行比较 Java代码优化 内存管理与分配 Android的多线程操作 Android’s Dalvik Java 与 Java SE ...

  8. Android Programming: Pushing the Limits -- Chapter 6: Services and Background Tasks

    什么时候使用Service 服务类型 开启服务 后台运行 服务通信 附加资源 什么时候使用Service: @.任何与用户界面无关的操作,可移到后台线程,然后由一个Service来控制这个线程. 服务 ...

  9. [iOS翻译]《iOS 7 Programming Pushing the Limits》系列:你可能不知道的Objective-C技巧

    简介: 如果你阅读这本书,你可能已经牢牢掌握iOS开发的基础,但这里有一些小特点和实践是许多开发者并不熟悉的,甚至有数年经验的开发者也是.在这一章里,你会学到一些很重要的开发技巧,但这仍远远不够,你还 ...

随机推荐

  1. iOS开发——项目篇—高仿百思不得姐

    01 一.包装为导航控制器 UINavigationController *nav = [[UINavigationController alloc] initWithRootViewControll ...

  2. iOS开发——UI基础-按钮内边距,图片拉伸

    一.内边距 UIButton有三个属性,分别可以设置按钮以及内部子控件的内边距 1.contentEdgeInsets 如果是设置contentEdgeInsets, 会把UIImageView和UI ...

  3. linux中chmod更改文件权限命令

    1. 命令格式: chmod [-cfvR] [--help] [--version] mode file 2. 命令功能: 用于改变文件或目录的访问权限,用它控制文件或目录的访问权限. 3. 命令参 ...

  4. (原)android中的动画(二)

    帧动画的使用需要在xml文件中指定每一帧所对应的图片 animation-list写法如下: <?xml version="1.0" encoding="utf-8 ...

  5. BZOJ 2124: 等差子序列

    Sol 线段树+Hash. 首先暴力 等差子序列至少3项就可以了,就枚举中项,枚举公差就可以了,只需要一个数在中项前出现,另一个数在中项前没出现过就可以了.复杂度 \(O(n^2)\) 然后我想了一个 ...

  6. 转:SQL子句的执行顺序

    SQL 不同于与其他编程语言的最明显特征是处理代码的顺序.在大数编程语言中,代码按编码顺序被处理,但是在SQL语言中,第一个被处理的子句是FROM子句,尽管SELECT语句第一个出现,但是几乎总是最后 ...

  7. 话说好像是这样,ios下面通常用iframe来打开你的scheme地址; Android下通常用location.href来。。。 不过实际情况好像比这个复杂得多。。

    http://js.40017.cn/touch/hb/p/openApp.js/** * Created by wsy10943 on 2015/5/18. */ window._web_publi ...

  8. 【SpringBoot】SpringBoot 入门示例

    参考资料: http://www.tuicool.com/articles/mqeee2A http://www.cnblogs.com/suncj/p/4065589.html http://spr ...

  9. iOS gcd dispatch使用注意,dispatch_syn可能产生的死锁

      我们在使用dispatch_sync 时可能会出现死锁,看下面的例子: import UIKit class ViewController: UIViewController { var seri ...

  10. Windows下安装Maven

    上篇文章刚说到Linux下安装maven的过程,有时候为了适合在本地构建项目开发,然后上传到远程服务器执行,需要在本地构建maven项目,那么一般就是在Windows下构建maven项目并导入到我们的 ...