This is a simple example of Aspect Oriented Programming in Android

Overview

Android-AOPExample Build Status

This is a simple example of Aspect Oriented Programming in Android as part of a blog post I have written. The idea was to measure how long takes a method to be executed, so based on annotations, a Metrics aspect was created for making easy to trace a method execution (you can take a look at the 'gintonic' folder). I wrote an article about Aspect Oriented Development in Android here:

After developing this I realized Jake Wharton has already created a very useful library called Hugo (I refactored my code to look like this amazing library but mine is kind of a more primitive version, although as an example works fine :)).

The idea is simple, you just add @DebugTrace to any method and in the logcat you will see something like this:

Gintonic --> onMeasure --> [10ms]

Local Development

Here are some useful Gradle/adb commands for executing this example:

  • ./gradlew clean build - Build the entire example.
  • ./gradlew installDebug - Install the debug apk in the current connected device.
  • adb shell am start -n android10.org.viewgroupperformance/org.android10.viewgroupperformance.activity.MainActivity - Start the Main Activity of the example.

License

Copyright 2014 Fernando Cejas

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.

http://www.fernandocejas.com

Buy Me A Coffee

You might also like...
PNPscript - ProdigyPNP's upcoming programming language, designed for hacking Prodigy.

PNPscript PNPscript - ProdigyPNP's upcoming programming language, designed for hacking Prodigy. THIS IS IN EARLY DEVELOPMENT. DON'T BOTHER TRYING TO A

Simple blockchain example written in Kotlin

Blockchain in Kotlin This is a plain example how Cryptographic blockchains work by constructing a blockchain containing three blocks. Once constructed

Example of Android project showing integration with Kotlin and Dagger 2

kotlin-dagger-example This project demonstrate how to setup an Android Project with Kotlin and Dagger 2. It's based on Dagger 2 example ##Known issues

The example Android project of animated menu items in toolbar
The example Android project of animated menu items in toolbar

Android Animated Menu Items The example Android project of animated menu items in toolbar. Thanks Srikant Shetty for idea of this animation. Cut: Copy

Learning RxJava for Android by example

Learning RxJava for Android by example This is a repository with real-world useful examples of using RxJava with Android. It usually will be in a cons

Weather application example with Android Architecture components and Clean Architecture

Weather application example with Android Architecture components and Clean Architecture Weather app that shows how to architect an android app in a cl

This is an example for running a Python library (mishkal) in Android using chaquopy
This is an example for running a Python library (mishkal) in Android using chaquopy

chaquopy-mishkal This is an example for running a Python library (mishkal) in Android using chaquopy Code All the code that has been added to run the

Movies-db-example - Sample Android application that loads movies data from a remote server

Movies Application Sample Android application that loads movies data from a remo

Basic example of using ItemTouchHelper to add drag & drop and swipe-to-dismiss to RecyclerView.

Another drag and swipe library? This project is an example of basic drag & drop and swipe-to-dismiss with RecyclerView using ItemTouchHelper. It corre

Comments
  • How to use aspectj in another module

    How to use aspectj in another module

    I want to use gintonic module in another module to track the classes there. What should be the gradle structure. I tried all the combinations and nothing seems to work. Kindly advice.

    opened by winster 1
  • cant not run sample app , build failed ,why?

    cant not run sample app , build failed ,why?

    Error:(45, 1) Execution failed for task ':gintonic:compileReleaseJavaWithJavac'.

    No such property: project for class: com.android.build.gradle.LibraryPlugin

    using gradle 2.3.3

    opened by huajianjiang 3
Owner
Fernando Cejas
Head of Engineering @TIGNUM. Former Director at @wireapp. Former @soundcloud Core Engineering. Ex @IBM. Curious learner. Geek. OPEN SOURCE Advocate.
Fernando Cejas
A performance-oriented fork of Purpur intended to increase performance for entity-heavy servers by implementing multi-threaded and asynchronous improvements.

Petal is a performance-oriented fork of Purpur intended to increase performance for entity-heavy servers by implementing multi-threaded and asynchronous improvements.

Bloom 224 Jan 3, 2023
This repo contains example code for O'Reilly's "Programming Android" by Zigured Mednieks, Laird Dornin, Blake Meike and Masumi Nakamura

This repo contains working code for the example in O'Reilly's _Programming Android, 2nd Edition_; Mednieks, Dornin, Meike, Nakamura (http://shop.orei

G. Blake Meike 214 Nov 25, 2022
This repo contains example code for O'Reilly's "Programming Android" by Zigured Mednieks, Laird Dornin, Blake Meike and Masumi Nakamura

This repo contains working code for the example in O'Reilly's _Programming Android, 2nd Edition_; Mednieks, Dornin, Meike, Nakamura (http://shop.orei

G. Blake Meike 165 Nov 11, 2022
Github-Api-Pagination-Example - Pagination 3 Example using Github Api

Github-Api-Pagination Pagination 3 Example using Github Api Tech Stack 100% Kotl

Anggoro Beno Lukito 2 Aug 22, 2022
An android app written in Kotlin Programming language which a user can use to store his/her monthly expenditure.

#Expenditure-Tracker An android app that allows the user to input , edit , view his/her expenditures for each month. Languages Used - Kotlin UI develo

Priyansh Agarwal 2 Aug 21, 2022
PhotoGallery app from 'Android Programming (4th edition)' By Big Nerd Ranch

PhotoGallery app An app from the book 'Android Programming (4th edition)' by Big Nerd Ranch Learned and worked with: Retrofit: Flickr API Calls @GET,

Dmitry Borovik 1 Oct 26, 2022
It is a project that contains lessons and examples about Kotlin programming language. 🇰

Kotlin Tutorials What is Kotlin? I added the platforms it supports and great resources. You can access the article from the link below: https://medium

Halil Özel 94 Dec 22, 2022
Minecraft JE Server Programming with JS like Skript, Trigger Reactor

mine.js(Developing) Minecraft Java Edition Scripting with JS(V8 Engine) by Netherald How to apply? Download Paper or Bungee Version. and put it to plu

null 9 Nov 10, 2021
Solutions to advent of code 2021 in the gen-Z programming language known as kotlin

Advent Of Code 2021 - Kotlin Edition How to run? Get the kotlin SDK using the sdkman tool: https://sdkman.io/sdks#kotlin Run the commands: ./gradlew

Arijan 2 Jan 7, 2022
The domain specific programming language D°, which is a result of Fabian Bruckner's PhD.

Data App Programming Language The data app programming language (named D° [spoken dəˈɡrē]) is a work result of the PhD of Fabian Bruckner. It is a dom

Fraunhofer Institute for Software and Systems Engineering ISST 2 Aug 19, 2022