第四部分 开发工具及测试工具
主要介绍和 Android 开发工具和测试工具相关的开源项目。
一、开发效率工具
-
Parceler
通过注解及工具类自动完成实体类 Parcelable 及值传递
项目地址:https://github.com/johncarl81/parceler -
Json2Java
根据 JSon 数据自动生成对应的 Java 实体类,还支持 Parcel、Gson Annotations 对应代码自动生成。期待后续的提取父类以及多 url 构建整个工程的功能
项目地址:https://github.com/jonfhancock/JsonToJava
在线演示:http://jsontojava.appspot.com/ -
IntelliJ Plugin for Android Parcelable boilerplate code generation
Android studio 插件,生成 Parcelable 代码
项目地址:https://github.com/mcharmas/android-parcelable-intellij-plugin
效果图: -
Android Holo Colors IntelliJ Plugin
Android studio 插件,生成 holo 样式 9 patch 图片
项目地址:https://github.com/jeromevdl/android-holo-colors-idea-plugin
效果图: -
Android Drawable Factory
用于生成各个分辨率的图片
项目地址:https://github.com/tizionario/AndroidDrawableFactory
效果图: -
SelectorChapek for Android
Android Studio 插件,可根据固定文件名格式资源自动生成 drawable selectors xml 文件。
项目地址:https://github.com/inmite/android-selector-chapek -
Android Action Bar Style Generator
Android ActionBar 样式生成器,可在线选择 ActionBar 样式自动生成所需要的图片资源及 xml 文件
项目地址:https://github.com/jgilfelt/android-actionbarstylegenerator
在线演示:http://jgilfelt.github.io/android-actionbarstylegenerator/ -
ButterKnifeZelezny
用于快速生成ButterKnifeView 注入代码的 Android Studio/IDEA 插件
项目地址:https://github.com/inmite/android-butterknife-zelezny -
RoboCoP
利用 Gradle task 根据固定格式的 json 文件生成 ContentProvider
项目地址:https://github.com/mediarain/RoboCoP -
appiconsizes
用于生成各个分辨率的图片
项目地址:http://www.appiconsizes.com/ -
AndroidUtiles 集合了所有常用的安卓工具类 项目地址:https://github.com/l123456789jy/Lazy
-
Gradle Retrolambda Plugin
Retrolambda是将 Java8 的 Lambdas 应用于 Java7 的工具,本项目是 Gradle 插件,通过 Retrolambda 从而使 Java 或 Android 项目用 Java8 的 Lambdas 编写,将编译后的字节码转换为 Java6 和 7 的字节码从而正常运行
项目地址:https://github.com/evant/gradle-retrolambda -
Dagger IntelliJ Plugin
dagger 的 intellij 插件
项目地址:https://github.com/square/dagger-intellij-plugin -
Android Gen Drawable Maven plugin
在编译时根据 SVG 描述文件生成不同分辨率的 jpg、png 或点 9 图片
项目地址:https://github.com/avianey/androidgendrawable-maven-plugin -
Android Asset Studio
各种 Android 资源自动生成器,包括启动图标、ActionBar 图标、通知栏图标、点 9 等
项目地址:https://github.com/romannurik/AndroidAssetStudio
在线演示:http://romannurik.github.io/AndroidAssetStudio/ -
jsonschema2pojo
根据 Json 内容生成 java 对象,支持 jackjson 和 gson
项目地址:https://github.com/joelittlejohn/jsonschema2pojo
在线演示:http://www.jsonschema2pojo.org/ -
GsonFormat
根据 JSONObject 格式的字符串,自动生成实体类参数的 Android Studio/IntelliJ IDEA 插件
项目地址:https://github.com/zzz40500/GsonFormat
效果图: -
9-Patch-Resizer
自动生成 png 及点 9 图片的不同分辨率版本
项目地址:https://github.com/redwarp/9-Patch-Resizer -
AndroidLocalizationer
可用于将项目中的 string 资源自动翻译为其他语言的 Android Studio/IntelliJ IDEA 插件
项目地址:https://github.com/westlinkin/AndroidLocalizationer -
Material Palette
一个将现有的色彩方案组合成材料设计的调色板方案,提供下载。选取两个主要色彩后便可以提供下载,提供下载的格式可以是 android 的资源 xml 文件,以色彩的方式提供,也可以是 CSS、SVG、PNG 等常见格式文件。
项目地址:http://www.materialpalette.com/
二、开发自测相关
-
Quality Tools for Android
Android 测试及自测工具集合和示例
项目地址:https://github.com/stephanenicolas/Quality-Tools-for-Android -
android-test-kit
Google 的 Android 测试工具
包括 GoogleInstrumentationTestRunner(增强版的 InstrumentationTestRunner)和 Espresso(用于快速写出可靠测试用例的 API)
项目地址:https://code.google.com/p/android-test-kit/
文档介绍:https://code.google.com/p/android-test-kit/w/list -
robolectric
测试用例编写框架
项目地址:https://github.com/robolectric/robolectric
Demo 地址:https://github.com/robolectric/robolectricsample
文档介绍:http://robolectric.org/
特点:(1). 不需要模拟器在一般 JVM 就可以运行测试用例
(2). 能完成在真机上的大部分测试包括感应器
其他的测试用例及相关模块 Mock 可见:android-mock, mockito, easy-mock -
Android FEST
提供一些列方便的断言,可用于提高编写 Android 自测代码效率
项目地址:https://github.com/square/fest-android -
BoundBox
可用于测试类各种访问权限的属性、方法。实际是通过 BoundBox 这个 annotation 生成一个属性和方法都是 public 权限的中间类并对此类进行测试完成的
项目地址:https://github.com/stephanenicolas/boundbox -
Hugo
用于打印函数信息及执行时间的工具,仅在 debug 模式生效
项目地址:https://github.com/JakeWharton/hugo -
scalpel
在应用下面添加一层用于界面调试
项目地址:https://github.com/JakeWharton/scalpel -
Android Screenshot library
Android 截图工具类,用于在持续集成时截图
项目地址:https://github.com/rtyley/android-screenshot-lib -
sonar-android-lint-plugin
将 android lint 的错误在 sonar 中展现
项目地址:https://github.com/SonarCommunity/sonar-android
三、测试工具
-
Spoon
可用于 android 不同机型设备自动化测试,能将应用 apk 和测试 apk 运行在不同机器上并生成相应测试报告。
项目地址:https://github.com/square/spoon -
Tencent APT
APT 是腾讯开源的一个 Android 平台高效性能测试组件,提供丰富实用的功能,适用于开发自测、定位性能瓶颈;测试人员完成性能基准测试、竞品对比测试
项目地址:https://github.com/stormzhang/APT -
Emmagee
网易开源的性能测试工具,包括 CPU、内存、网络流量、启动时间、电池状态等
项目地址:https://github.com/NetEase/Emmagee -
Android py-uiautomator
py-uiautomator 是一个对 Android uiautomator 用 python 进行封装的测试框架.
项目地址:https://github.com/xiaocong/uiautomator -
Augmented Traffic Control
模拟网络状况,包括带宽、时延抖动、丢包率、错包率、包重排率
项目地址:https://github.com/facebook/augmented-traffic-control -
stetho
强大的 Android Debug 工具。支持网络请求监控以及数据库查看,可以和 Chrome DevTools 结合或者命令行模式。
项目地址:https://github.com/facebook/stetho
四、开发及编译环境
-
Buck
facebook 开源的 Android 编译工具,效率是 ant 的两倍。主要优点在于:
(1) 加快编译速度,通过并行利用多核 cpu 和跟踪不变资源减少增量编译时间实现
(2) 可以在编译系统中生成编译规则而无须另外的系统生成编译规则文件
(3) 编译同时可生成单元测试结果
(4) 既可用于 IDE 编译也可用于持续集成编译
(5) facebook 持续优化中
项目地址:https://github.com/facebook/buck -
Android Maven Plugin
Android Maven 插件,可用于对 android 三方依赖进行管理。在 J2EE 开发中,maven 是非常成熟的依赖库管理工具,可统一管理依赖库。
项目地址:https://github.com/jayway/maven-android-plugin -
umeng-muti-channel-build-tool
渠道打包工具
项目地址:https://github.com/umeng/umeng-muti-channel-build-tool
另可参见 Google 的构建系统 Gradle:http://tools.android.com/tech-docs/new-build-system/user-guide -
Genymotion
目前最好用最快的 android 模拟器
项目地址:http://www.genymotion.com/
Android studio 集成控件: http://plugins.jetbrains.com/plugin/7269?pr=idea
Cyril Mottier 推荐:http://cyrilmottier.com/2013/06/27/a-productive-android-development-environment/ -
gradle-mvn-push
方便的将 Gradle 的 Artifacts 上传到 Maven 仓库
项目地址:https://github.com/chrisbanes/gradle-mvn-push
文档介绍:https://github.com/chrisbanes/gradle-mvn-push#usage -
Android Emulator Plugin for Jenkins
Android 模拟器 jenkins 插件,用于 Jenkins 做持续集成时跑模拟器测试
项目地址:https://github.com/jenkinsci/android-emulator-plugin -
Android Maven Plugin
管理应用所需要的依赖库。包括的构建工具有 Maven、Gradle、ant、sbt
项目地址:https://github.com/mosabua/maven-android-sdk-deployer -
SDK Manager Plugin
下载和管理 Android SDK 的 Gradle 插件
项目地址:https://github.com/JakeWharton/sdk-manager-plugin -
Gradle Protobuf Plugin
将.proto 文件转换成 Java 文件的 gradle 插件
项目地址:https://github.com/andrewkroh/gradle-protobuf-plugin -
ChromeADB
Chrome 的 Adb 插件,当登录后,能看到所有连接的设备并操作,可以看应用、进程、内存及磁盘使用情况等
项目地址:https://github.com/importre/chromeadb
五、其他
-
GT
APP的随身调试平台,它是直接运行在手机上的“集成调试环境”(IDTE, Integrated Debug Environment)。
项目地址:https://github.com/TencentOpen/GT
文档介绍:http://gt.qq.com/docs.html -
ViewServer
允许 app 运行在任何手机上都可以用 HierarchyViewer 查看
项目地址:https://github.com/romainguy/ViewServer -
GridWichterle for Android
在整个系统上显示一个 grid,用来帮助查看应用布局及使得布局更美观,可设置 grid 网格大小和颜色,android 推荐 48dp 和 8dp,可见 Android Design Guidelines – Metrics and Grids,比起 hierarchyviewer 相差甚远,不过偶尔可用来作为布局查看工具。
项目地址:https://github.com/inmite/android-grid-wichterle
Demo 地址:https://play.google.com/store/apps/details?id=eu.inmite.android.gridwichterle -
Catlog
手机端 log 查看工具,支持不同颜色显示、关键字过滤、级别过滤、进程 id 过滤、录制功能等
项目地址:https://github.com/nolanlawson/Catlog
在线演示:https://play.google.com/store/apps/details?id=com.nolanlawson.logcat -
PID Cat
根据 package 查看 logcat 日志
项目地址:https://github.com/JakeWharton/pidcat -
ACRA
应用崩溃信息日志上报到 GoogleDoc 工具,网页版展现结果三方开源地址https://github.com/BenoitDuffez/crashreportsviewer
项目地址:https://github.com/ACRA/acra
文档介绍:https://github.com/ACRA/acra/wiki/BasicSetup -
Crashlytics
提供丰富的应用崩溃信息日志收集
轻量级,丰富,可自定义应用崩溃信息收集器,附有邮件通知
项目地址:http://www.crashlytics.com/
集成插件:Android Studio, Eclipse and IntelliJ -
Android Resource Navigator
chrome 插件,可以方便的查看 github 上 android 源码工程的 styles.xml 和 themes.xml。主要功能:
(1) 快速打开 android styles.xml themes.xml
(2) 方便在资源间跳转。styles.xml themes.xml 文件中资源链接跳转,可以方便跳转到某个资源
(3) 方便查找某个 style 和 theme。chrome 地址栏输入 arn+tab+搜索内容回车即可
(4) 自动下载不同分辨率下的 drawable
(5) 通过映射查找那些不是按照固定命名规则命名的 style 和 theme
项目地址:https://github.com/jgilfelt/android-resource-navigator
在线演示:https://chrome.google.com/webstore/detail/android-resource-navigato/agoomkionjjbejegcejiefodgbckeebo?hl=en&gl=GB -
android-resource-remover
根据 lint 的提示删除项目中无用的资源,减少包的大小
项目地址:https://github.com/KeepSafe/android-resource-remover -
Telescope
通过手势截图以特定主题发送到特定邮箱地址报告 Bug
项目地址:https://github.com/mattprecious/telescope -
Complete Android Fragment & Activity Lifecycle
完整的 Android Fragment/Activity 生命周期图
项目地址:https://github.com/xxv/android-lifecycle -
Bugsnag Notifier for Android
通过Thread.UncaughtExceptionHandler
捕获应用未处理的异常崩溃 Bug 并用 Notification 展示同时上传到后台服务器
项目地址:https://github.com/bugsnag/bugsnag-android
文档介绍:https://github.com/bugsnag/bugsnag-android#installation--setup -
Material Design Icons
Google Material Design 规范中的 Icon
项目地址:https://github.com/google/material-design-icons -
scrollscreenshot
Android 滚动屏幕自动截图 jar 包,支持纵向、横向滚动截屏拼接
项目地址:https://github.com/PGSSoft/scrollscreenshot
效果图: -
droidicon
1600+的海量 Icon,包括 750+的 Material Design icons
项目地址:https://github.com/theDazzler/droidicon -
leakcanary
Android 内存泄露检测工具,集成方便,出现泄露后报告直观
项目地址:https://github.com/square/leakcanary
效果图: -
CacheUtilsLibrary
将任何Java Object类型的数据序列化后写入缓存文件,将来使用时读取缓存文件并反序列化成对应Java Object的库
项目地址:https://github.com/westlinkin/CacheUtilsLibrary -
BlockCanary
BlockCanary是一个Android平台的一个非侵入式的性能监控组件,应用只需要实现一个抽象类,提供一些该组件需要的上下文环境,就可以在平时使用应用的时候检测主线程上的各种卡慢问题,并通过组件提供的各种信息分析出原因并进行修复。
项目地址: https://github.com/moduth/blockcanary