• Stars
    star
    1,542
  • Rank 30,345 (Top 0.6 %)
  • Language
    Java
  • Created almost 9 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Performance metrics library for Android development (includes dagger2metrics)

AndroidDevMetrics

(formerly dagger2metrics)

Performance metrics library for Android development.

Android Arsenal

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

screenshot.png

Getting started

Script below shows how to enable all available metrics.

In your build.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:

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:

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


If it seems that layout or view can be a reason of performance issue you should start with those links from official Android documentation:


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.

Example app

You can check 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.

More Repositories

1

InstaMaterial

Implementation of Instagram with Material Design (originally based on Emmanuel Pacamalan's concept)
Java
4,997
star
2

LikeAnimation

Android like button with delightful star animation inspired by Twitter's heart. See blog post for description.
Java
1,666
star
3

GithubClient

Example of Github API client implemented on top of Dagger 2 DI framework.
Java
1,204
star
4

FlatBuffs

Example app showing FlatBuffers implementation in Android
C++
368
star
5

Google-Actions-Java-SDK

(Deprecated) Unofficial Google Actions Java SDK - for Android engineers and all Java lovers
Java
275
star
6

MultiModuleGithubClient

Example multi-module Android project with unit tests, dagger 2, test coverage and others
Java
254
star
7

RecyclerViewAnimations

Implementation of example app showing RecyclerView animations, presented on Android Dev Summit 2015 (this is not official source code)
Java
190
star
8

ActivityFrameMetrics

Detect janky frames with Android Nougat FrameMetrics
Java
136
star
9

Dagger2Recipes-ActivitiesMultibinding

Example app which shows how to build Activities Subcomponents Multibinding
Java
120
star
10

Dagger2Recipes-UserScope

Example app which shows how to create UserScope in Dagger 2
Java
86
star
11

DrawerLayoutInstaller

Simple tool which helps you to inject DrawerLayout into existing Activity layout tree
Java
70
star
12

HelloMultidex

Example project for multi-dex project in Android
Java
70
star
13

dagger2metrics

Deprecated: this project evolved to AndroidDevMetrics (metrics for Android Development, not only for Dagger 2) and now can be found here:
Java
54
star
14

WaterLog-assistant-app

Track your daily water intake with Google Assistant and voice interfaces.
JavaScript
41
star
15

MNIST-TFLite

MNIST classifier built for TensorFlow Lite - Android, iOS and other "lite" platforms
Jupyter Notebook
37
star
16

TFLite-Tester

Example project showing how we can compare TensorFlow and TensorFlow Lite models
Jupyter Notebook
25
star
17

Dagger2Recipes-InjectEverything

Example app which shows how to make use from Multibindings and AutoFactory in Dagger 2
Java
17
star
18

GTSRB-TensorFlow-Lite

TensorFlow Lite classification model for German Traffic Sign Benchmarks dataset, built on top of MobileNet v1
Jupyter Notebook
14
star
19

Dagger2Recipes-AsyncInjection

Example app which shows how to make async injection with RxJava in Dagger 2
Java
12
star
20

TFLite-Checker

Inspecting *.tflite models to get enough knowledge for implementing them in Android apps.
Jupyter Notebook
10
star
21

Github-Google-Actions

Github Actions - Hello world Java/AppEngine app for Google Assistant
Java
6
star
22

TF-to-CoreML

Jupyter Notebook
5
star
23

DimensionsDifferences

This example app shows differences between Android dimensions - px, pt, dp, mm, in and sp.
Java
3
star
24

Unlocker

Unlock your hardware device via SparkCore, iBeacon and iOS (driven by SwiftLang). Made for fun at #SwiftCrunch
Swift
1
star