• Stars
    star
    206
  • Rank 190,504 (Top 4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated about 9 years ago

Reviews

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

Repository Details

Logs all lifecycle methods of annotated Activities, Fragments, Services, Views, etc.

⟳ loglifecycle Maven Central

Logs all lifecycle methods of annotated activities, fragments, views, etc. on Android.

###Usage

Inside your build.gradle file, add :

apply plugin: 'loglifecycle'

And now, annotate every Activity you want to see its life cycle logged in logcat :

@LogLifeCycle
public class MainActivity extends Activity {
...
}

You will see something like this in logcat :

> adb logcat | grep ⟳

D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onCreate
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onApplyThemeResource
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowAttributesChanged
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowAttributesChanged
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowAttributesChanged
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onContentChanged
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onAttachFragment
D/LogLifeCycle( 4640): MainActivity$MainFragment [1384183528] ⟳ onCreate
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onStart
D/LogLifeCycle( 4640): MainActivity$MainFragment [1384183528] ⟳ onStart
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onTitleChanged
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onPostCreate
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onResume
D/LogLifeCycle( 4640): MainActivity$MainFragment [1384183528] ⟳ onResume
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onPostResume
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onAttachedToWindow
D/LogLifeCycle( 4640): MainActivity [1384162984] ⟳ onWindowFocusChanged

Extra features :

  • release builds won't log anything, indeed the app is not modified at all in release builds.
  • this plugin will add only a few more bytes to your app : log statements, and the annotation class, nothing more.

###Example

You will find an example app using LogLifeCycle in the repo.

###How does it work ?

Thanks to

  • morpheus, byte code weaver for android.
  • AfterBurner, byte code weaving swiss army knife for Android.

Related projects

On the same principle of byte code weaving :

###TODO

  • add tests

CI

Travis Build Coverage Status

License

Copyright (C) 2014 Stéphane NICOLAS

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

robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Java
2,946
star
2

Quality-Tools-for-Android

Java
1,266
star
3

toothpick

A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.
Java
1,123
star
4

boundbox

BoundBox provides an easy way to test an object by accessing all its fields, constructor and methods, public or not. BoundBox breaks encapsulation.
Java
229
star
5

RoboDemo

RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.
Java
215
star
6

reflection-no-reflection

A proof on concept to create an API that is 100% compatible reflection API, but without any reflection. Performance stuff for Android and Java.
Java
130
star
7

ormlite-android-gradle-plugin

A Gradle plugin for Android to generate an ORMLite configuration file and boost DAOs creations.
Java
102
star
8

morpheus

An Android gradle plugin to transform classes via javassist.
Java
80
star
9

afterburner

A library to help other librairies getting rid of boiler plate via byte code manipulation. Works on Android too.
Java
74
star
10

injectextra

Injects everything passed by extra to an activity automatically.
Java
26
star
11

androidstudio4maccheatsheet

Most useful keyboard shortcuts with default keymap in Android Studio.
23
star
12

mimic

Mimicing is, indeed, kind of way to bypass java single inheritance paradigm. It allows to copy all declared fields, constructors and methods in a given class into another class.
Java
19
star
13

activtity-fragment-lambda

Example of how to use lambdas to communicate between Fragments and Activities
Java
17
star
14

injectview

On Android, Injects all views inflated from XML automatically. No boiler plate at all.
Java
17
star
15

injects

This repo is a control center for the injects projects.
9
star
16

injectresource

Inject resources automatically on Android.
Java
8
star
17

javassist-build-plugin-api

A unified API to create class transformers based on javassist during maven and gradle builds.
Java
7
star
18

TypedAdapter

Object Oriented android list view adapter(s) using generics to display given Pojos.
Java
5
star
19

google-guice

A fork of Google Guice to allow RoboGuice to go faster at startup.
Java
3
star
20

zest-android

Sample app to demonstrate roboguice usage + testing
Java
3
star
21

Dependency-Resources-Linearization

Demonstrate that the linearization of the dependency graph that gives to the order of priority to aapt2 when merging resources is hard to grasp for humans and that we can quickly have problems when scaling the number of modules.
Kotlin
3
star
22

MixedServiceLifeCycle-sample

A sample to demonstrate that a mixed life cycle service (both started and bound) is buggy. Built for a common guy ;)
Java
2
star
23

heatControl

Controls a custom micro controller on a heating system
Kotlin
1
star
24

bugs-instant-execution

Sample project to illustrate instant execution bugs in Android projects
Shell
1
star