AndroidDevMetrics


Source link: https://github.com/frogermcs/AndroidDevMetrics

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

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

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

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. 

Resources

A square animated loader.

VRCategoryView is inspired by Ebay's category animation and design.

The view is capable of showing categories and sub categories. The first level will be shown in a grid with image and title. The second level can be shown however you like with passing in an adapter for RecyclerView.

This is an improved version of the original FragmentStatePagerAdapter with important changes that add support for changing the order and count of items.

Morphing play-pause animated drawable.

To solve database upgrade of greenDao and just need one line code.

Gradient-Artist library will allow you to use gradient overly on top of the image. It uses Glide for network image loading.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes