Android代码-AndroidDevMetrics

  • M5_528371
    了解作者
  • 681.3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-15 11:52
    上传日期
AndroidDevMetrics (formerly dagger2metrics) Performance metrics library for Android development. The problem with performance is that it often decreases slowly so in day-by-day development it's hard to notice that our app (or Activity or any other view) launches 50ms longer. And another 150ms longer, and another 100ms... With AndroidDevMetrics you will be able to see how performant are the most common operations like object initialization (in Dagger 2 graph), or Activity lifecycle methods (onC
Android代码-AndroidDevMetrics.zip
内容介绍
# AndroidDevMetrics (formerly dagger2metrics) Performance metrics library for Android development. [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidDevMetrics-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/3120) The problem with performance is that it often decreases slowly so in day-by-day development it's hard to notice that our app (or Activity or any other view) launches 50ms longer. And another 150ms longer, and another 100ms... With **AndroidDevMetrics** you will be able to see how performant are the most common operations like object initialization (in Dagger 2 graph), or Activity lifecycle methods (`onCreate()`, `onStart()`, `onResume()`). It won't show you exact reason of performance issues or bottlenecks (yet!) but it can point out where you should start looking first. AndroidDevMetrics currently includes: * Activity lifecycle metrics - metrics for lifecycle methods execution (`onCreate()`, `onStart()`, `onResume()`) * Activity lifecycle methods tracing without app recompiling * Frame rate drops - metrics for fps drops for each of screens (activity) * Dagger 2 metrics - metrics for objects initialization in Dagger 2 ![screenshot1.png](https://raw.githubusercontent.com/frogermcs/androiddevmetrics/master/art/activities_metrics.png) ![screenshot.png](https://raw.githubusercontent.com/frogermcs/androiddevmetrics/master/art/dagger2_metrics.png) ## Getting started Script below shows how to enable all available metrics. In your `build.gradle`: ```gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.7' } } apply plugin: 'com.android.application' apply plugin: 'com.frogermcs.androiddevmetrics' ``` In your `Application` class: ```java public class ExampleApplication extends Application { @Override public void onCreate() { super.onCreate(); //Use it only in debug builds if (BuildConfig.DEBUG) { AndroidDevMetrics.initWith(this); } } } ``` ## How does it work? Detailed description how it works under the hood can be found on wiki pages: * [Activity lifecycle and frame drops metrics](https://github.com/frogermcs/AndroidDevMetrics/wiki/Activity-lifecycle-metrics) * [Activity lifecycle methods tracing](http://frogermcs.github.io/androiddevmetrics-activity-lifecycle-methods-tracing/) * [Dagger 2 metrics](https://github.com/frogermcs/AndroidDevMetrics/wiki/Dagger-2-metrics) ## I found performance issue, what should I do next? There is no silver bullet for performance issues but here are a couple steps which can help you with potential bugs hunting. If measured time of object initialization or method execution looks suspicious you should definitely give a try to [TraceView](http://developer.android.com/tools/debugging/debugging-tracing.html). This tool logs method execution over time and shows execution data, per-thread timelines, and call stacks. Practical example of TraceView usage can be found in this blog post: [Measuring Dagger 2 graph creation performance](http://frogermcs.github.io/dagger-graph-creation-performance/]). --- If it seems that layout or view can be a reason of performance issue you should start with those links from official Android documentation: * http://developer.android.com/training/improving-layouts/index.html * http://developer.android.com/training/improving-layouts/optimizing-layout.html --- Finally, if you want to understand where most of performance issues come from, here *is a collection of videos focused entirely on helping developers write faster, more performant Android Applications.* * [Android Performance Patterns](https://www.youtube.com/playlist?list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE) ## Example app You can check [GithubClient](https://github.com/frogermcs/githubclient) - example Android app which shows how to use Dagger 2. Most recent version uses **AndroidDevMetrics** for measuring performance. ## Building AndroidDevMetrics Build AndroidDevMetrics plugin with [`./gradlew clean build`]. The tests can be run with `./gradlew clean test`. To install the plugin in your local maven repository (usually located at `~/.m2/repository`) use `./gradlew clean install`. You can change `VERSION_NAME` value in `gradle.properties` to easily recognise your version. ## License Copyright 2016 Miroslaw Stanek Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
评论
    相关推荐
    • android licensing lib
      Android licensing library source
    • Android library
      Android library
    • Android observable
      Android 泡泡堂5.0UI用在5.0以下的手机上.提供library库和使用demo
    • android手势库
      一个简单的手势库的建立与使用,菜鸟的学习之路。...两点注意事项 1.android:gestureStrokeType="multiple"(不知道怎么描述,自己试一下就知道了) 2.读取使用手势记得先调用GestureLibrary.load()方法。
    • androidLibrary
      androidLibrary
    • android v7包
      v7包,下载后导入到项目中,作为一个项目,然后设置properties,android,勾选islibrary,然后在你需要导入v7包的项目中选properties,android然后在library中add这个项目就好了
    • android 图表 工具
      android 的平台上绘制图形的library 以及相关的Api 开放文档等
    • Android Query 文档
      Android Query 离线文档。 Android-Query (AQuery) is a light-weight library for doing asynchronous tasks and manipulating UI elements in Android 。 一个轻量级的库,可以执行异步任务和操作UI。 如果你知道...
    • android_viewflow
      ViewFlow is an Android UI widget providing a horizontally scrollable ViewGroup with items populated from an Adapter. Scroll down to the bottom of the page for a screen shot. The component is a ...
    • android TTS jar
      android 系统自带的TTS,很多不支持中文阅读,上线之后受用户机型影响比较大,TTS_library_stub_3.0_market jar ,可以摆脱机型束缚