Android Apps with Groovy
About me
● Mario Garcia
– Software engineer at Kaleidos
https://github.com/mariogarcia
@marioggar
Before I begin...
● Thanks to Tuenti
● Disclaimer
– I'm not an Android developer
– Questions welcomed :)
What is this talk about ?
● Summary
– Android is NOT ONLY Java
– Your first Grooid app
– Groovy features
– Useful libraries
– Reactive
– Testing
– Q & A
Android is NOT ONLY Java
● Why not Groovy ?
– Why not… ?
– Chose your poison:
Create your first
Android/Groovy app
Create your first Groovy app
● The Android Studio wizard
– Meant for Java
– If you go this way, then:
● Create a Java app through the wizard
● Add Groovy/Gradle plugin
● Add needed basic dependencies
● …
Create your first Groovy app
● A better way:
– Create a basic skeleton with Lazybones
– Import as Gradle project to Android Studio
– Profit!
Create your first Groovy app
● Lazybones
– A simple project creation tool
– Templates
– Really easy to use and extend
Create your first Groovy app
● Grooid templates
– Lazybones templates for creating:
● Android app, Android lib
● Coming soon: Google Glass app
Create your first Groovy app
● Gradle
– Android Reference build tool
– Convention over Configuration
– Still thinking of Maven ? check this out:
● https://gradle.org/maven_vs_gradle/
Create your first Groovy app
● Android Studio
– Reference IDE based on Intellij IDEA
– Really helpful specially for UI
– Integrates perfectly with Gradle projects
Create your first Groovy app
● Demo
Groovy features
out-of-the-box
Groovy features
● Domain classes
● Get rid of accessors
● No need to override constructors
● More AST to do pumbling staf
– @AutoExternalize
– @Canonical
– @Immutable
– @InheritConstructors
– …. many more
Groovy features
● Beans
Groovy features
● Constructors
Groovy features
● GDK
– Groovy extensions to the JDK
● Groovy collections (collect/inject/find)
● Safe methods to deal with JDK Classes
– e.g: take(int) : use it instead of substring
Groovy features
● NPE and Exceptions
– NPE
● ? operator
● * operator
● Elvis :?
– Exceptions
● Go functional || Reactive
– FNZ: Try<T>, Maybe<T>
– RxJava/RxAndroid: onError()
Groovy features
● Safe operators
Groovy Features
● FNZ
Groovy features
● Closures
● No need to create inner classes anymore
● Wherever there is a Functional Interface you can
use a Closure
● Also useful when creating DSLs
Groovy features
● Closures
Groovy features
● Closures (cont)
Groovy features
● DSLs
Groovy features
● Traits
– Have you ever wanted to share some
functionality between an Activity and a
ListActivity ?
● Another way to share functionality among class
hierarchies
● Used as if it were an interface
● IDE friendly
Groovy features
Provides waiting spinner
Provides easier call to Toast.makeXXX
● Traits
Groovy advanced
Features
Advanced features
● Extension Modules
– Add new functionality to existing code
– Easy to use and program
● Just classes with static methods
● Android Studio recognizes Extension Modules out-of-
the-box
Advanced features
Busted!
● Extension modules
Advanced features
● Custom ASTs
– Add new functionality to existing code
● During compilation time
● Extremely powerful
● No need for an annotation-processor
● Harder to code than Extension Modules
Advanced features
● Show a dialog
Advanced features
Advanced features
Advanced features
● Swissknife
– Makes easier to deal with view injection and
threading nightmare.
● Based on AndroidAnnotations and ButterKnife
● Collection of: ASTs, DSLs, Extension Modules
Reactive
Programming
Reactive Programming
● RxAndroid + Groovy
– Less verbose than using Java:
● Closures and Functional Interface coertion
● Composable Closures
● Method Reference
Code
Testing
And
Quality
Testing
● Spock
– A better way of testing
● DSL to describe your tests in a fluent way
● Compatible with JUnit
Testing
● AndroidSpock
– Create integration tests
● Under src/androidTest/groovy
● Helpers to inject and initialize activities in your tests
● Deploys and run tests in the device
Testing
● Robospock
– Create unit tests
● Based on roboelectric 3.0
● no DEXing or deployment time is wasted to execute
your unit tests.
Other tools
● Quality code
– Codenarc
● Static analysis for Groovy
● Highly Configurable
● Completely integrated with Gradle
References
● Links
● Android Studio
– https://developer.android.com/sdk/index.html
● Lazybones
– https://github.com/pledbrook/lazybones
● Grooid templates
– https://github.com/mariogarcia/grooid-templates
● Swissknife
– https://github.com/Arasthel/SwissKnife
● AndroidRx
– https://github.com/ReactiveX/RxAndroid
References
● Links
● Spock
– http://spockframework.github.io/spock/docs/1.0/index.html
● Android Spock
– https://github.com/pieces029/android-spock
● Robo Spock
– http://robospock.org/
● Gradle
– https://gradle.org/
● Groovy Lang
– http://www.groovy-lang.org/
References
● Links
● Codenarc
– http://codenarc.sourceforge.net/
● FNZ
– http://mariogarcia.github.io/fnz/
Q & A
Common question
● Size of Groovy :grooid ?
Thanks!!

More Related Content

PDF
Spring-batch Groovy y Gradle
PPTX
Geb+spock: let your functional tests live long and prosper
PDF
Jedi knight
PDF
Whats New In Groovy 1.6?
PDF
Dsl로 만나는 groovy
ODP
eXo EC - Groovy Programming Language
PDF
Use groovy & grails in your spring boot projects
PPS
Groovy & Grails
Spring-batch Groovy y Gradle
Geb+spock: let your functional tests live long and prosper
Jedi knight
Whats New In Groovy 1.6?
Dsl로 만나는 groovy
eXo EC - Groovy Programming Language
Use groovy & grails in your spring boot projects
Groovy & Grails

What's hot (20)

PDF
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
PDF
It is easy contributing to open source - JCON 2020
PDF
Groovy and noteworthy
PDF
Buildr - build like you code
PDF
Understanding how concurrency work in os
PPTX
PDF
An introduction to_golang.avi
PDF
Stop Sucking at Building Stuff!
PDF
Android build process (1)
PDF
Golang from Scala developer’s perspective
PDF
PDF
How to debug mruby (rubyconftw2014)
PDF
Golang for PHP programmers: A practical introduction
PDF
TDD with Spock @xpdays_ua
PDF
Writing mruby Debugger
PDF
PyQt: rapid application development
ODP
What's unique to Qt
PPTX
45 Tools to Boost Your Front-End
ODP
Besut Kode Challenge 1
Paving the road with Jakarta EE and Apache TomEE - JCON 2021
It is easy contributing to open source - JCON 2020
Groovy and noteworthy
Buildr - build like you code
Understanding how concurrency work in os
An introduction to_golang.avi
Stop Sucking at Building Stuff!
Android build process (1)
Golang from Scala developer’s perspective
How to debug mruby (rubyconftw2014)
Golang for PHP programmers: A practical introduction
TDD with Spock @xpdays_ua
Writing mruby Debugger
PyQt: rapid application development
What's unique to Qt
45 Tools to Boost Your Front-End
Besut Kode Challenge 1
Ad

Similar to Groovy android (20)

ODP
Unit Test Android Without Going Bald
PDF
Go at Skroutz
PDF
Gradle build automation tool
ODP
Build and Deploy a Python Web App to Amazon in 30 Mins
PDF
Testing on Android
PPTX
Creating a reasonable project boilerplate
PPTX
Android Study Jam
ODP
Behat Workshop at WeLovePHP
PPTX
Autolab Workshop
PPTX
Exploring the power of Gradle in android studio - Basics & Beyond
PDF
Keeping your build tool updated in a multi repository world
PDF
Usable Software Design
PPTX
TDD with Python and App Engine
PDF
Best practices for JavaScript RIAs
PPTX
Gradle: One technology to build them all
ODP
Plone Intranet under the hood
PDF
RealDay: Angular.js
PDF
Counterclockwise past present future
PDF
Continuous integration for androids
PDF
Docker and Go: why did we decide to write Docker in Go?
Unit Test Android Without Going Bald
Go at Skroutz
Gradle build automation tool
Build and Deploy a Python Web App to Amazon in 30 Mins
Testing on Android
Creating a reasonable project boilerplate
Android Study Jam
Behat Workshop at WeLovePHP
Autolab Workshop
Exploring the power of Gradle in android studio - Basics & Beyond
Keeping your build tool updated in a multi repository world
Usable Software Design
TDD with Python and App Engine
Best practices for JavaScript RIAs
Gradle: One technology to build them all
Plone Intranet under the hood
RealDay: Angular.js
Counterclockwise past present future
Continuous integration for androids
Docker and Go: why did we decide to write Docker in Go?
Ad

More from Mario García (16)

PDF
Blockchain 101 (spanish)
PDF
Jbake workshop (Greach 2019)
PDF
Groovy 2.5 and 3.0 (Spanish)
PDF
GraphQL & Ratpack
PDF
GraphQL y Groovy
PDF
Calidad del codigo (MadridGUG)
PDF
GraphQL and Groovy
PDF
Macro macro, burrito burrit
PDF
Creating ASTTs The painful truth
PDF
Groovy on Android
PDF
Gpars Workshop 2014
PDF
Functional Programming with Groovy
PPT
Test Motherfucker...Test
PDF
Programación concurrente con GPars
PDF
Gradle vs Maven
PPT
Greach 2011 : Creando Plugins Con Griffon
Blockchain 101 (spanish)
Jbake workshop (Greach 2019)
Groovy 2.5 and 3.0 (Spanish)
GraphQL & Ratpack
GraphQL y Groovy
Calidad del codigo (MadridGUG)
GraphQL and Groovy
Macro macro, burrito burrit
Creating ASTTs The painful truth
Groovy on Android
Gpars Workshop 2014
Functional Programming with Groovy
Test Motherfucker...Test
Programación concurrente con GPars
Gradle vs Maven
Greach 2011 : Creando Plugins Con Griffon

Recently uploaded (20)

PDF
Unlock new opportunities with location data.pdf
PDF
Architecture types and enterprise applications.pdf
PPTX
Modernising the Digital Integration Hub
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPT
Geologic Time for studying geology for geologist
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Getting Started with Data Integration: FME Form 101
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
The various Industrial Revolutions .pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Five Habits of High-Impact Board Members
Unlock new opportunities with location data.pdf
Architecture types and enterprise applications.pdf
Modernising the Digital Integration Hub
NewMind AI Weekly Chronicles – August ’25 Week III
Getting started with AI Agents and Multi-Agent Systems
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Geologic Time for studying geology for geologist
Chapter 5: Probability Theory and Statistics
Benefits of Physical activity for teenagers.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Getting Started with Data Integration: FME Form 101
A comparative study of natural language inference in Swahili using monolingua...
Zenith AI: Advanced Artificial Intelligence
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
The various Industrial Revolutions .pptx
Developing a website for English-speaking practice to English as a foreign la...
Five Habits of High-Impact Board Members

Groovy android

  • 2. About me ● Mario Garcia – Software engineer at Kaleidos https://github.com/mariogarcia @marioggar
  • 3. Before I begin... ● Thanks to Tuenti ● Disclaimer – I'm not an Android developer – Questions welcomed :)
  • 4. What is this talk about ? ● Summary – Android is NOT ONLY Java – Your first Grooid app – Groovy features – Useful libraries – Reactive – Testing – Q & A
  • 5. Android is NOT ONLY Java ● Why not Groovy ? – Why not… ? – Chose your poison:
  • 7. Create your first Groovy app ● The Android Studio wizard – Meant for Java – If you go this way, then: ● Create a Java app through the wizard ● Add Groovy/Gradle plugin ● Add needed basic dependencies ● …
  • 8. Create your first Groovy app ● A better way: – Create a basic skeleton with Lazybones – Import as Gradle project to Android Studio – Profit!
  • 9. Create your first Groovy app ● Lazybones – A simple project creation tool – Templates – Really easy to use and extend
  • 10. Create your first Groovy app ● Grooid templates – Lazybones templates for creating: ● Android app, Android lib ● Coming soon: Google Glass app
  • 11. Create your first Groovy app ● Gradle – Android Reference build tool – Convention over Configuration – Still thinking of Maven ? check this out: ● https://gradle.org/maven_vs_gradle/
  • 12. Create your first Groovy app ● Android Studio – Reference IDE based on Intellij IDEA – Really helpful specially for UI – Integrates perfectly with Gradle projects
  • 13. Create your first Groovy app ● Demo
  • 15. Groovy features ● Domain classes ● Get rid of accessors ● No need to override constructors ● More AST to do pumbling staf – @AutoExternalize – @Canonical – @Immutable – @InheritConstructors – …. many more
  • 18. Groovy features ● GDK – Groovy extensions to the JDK ● Groovy collections (collect/inject/find) ● Safe methods to deal with JDK Classes – e.g: take(int) : use it instead of substring
  • 19. Groovy features ● NPE and Exceptions – NPE ● ? operator ● * operator ● Elvis :? – Exceptions ● Go functional || Reactive – FNZ: Try<T>, Maybe<T> – RxJava/RxAndroid: onError()
  • 22. Groovy features ● Closures ● No need to create inner classes anymore ● Wherever there is a Functional Interface you can use a Closure ● Also useful when creating DSLs
  • 26. Groovy features ● Traits – Have you ever wanted to share some functionality between an Activity and a ListActivity ? ● Another way to share functionality among class hierarchies ● Used as if it were an interface ● IDE friendly
  • 27. Groovy features Provides waiting spinner Provides easier call to Toast.makeXXX ● Traits
  • 29. Advanced features ● Extension Modules – Add new functionality to existing code – Easy to use and program ● Just classes with static methods ● Android Studio recognizes Extension Modules out-of- the-box
  • 31. Advanced features ● Custom ASTs – Add new functionality to existing code ● During compilation time ● Extremely powerful ● No need for an annotation-processor ● Harder to code than Extension Modules
  • 35. Advanced features ● Swissknife – Makes easier to deal with view injection and threading nightmare. ● Based on AndroidAnnotations and ButterKnife ● Collection of: ASTs, DSLs, Extension Modules
  • 37. Reactive Programming ● RxAndroid + Groovy – Less verbose than using Java: ● Closures and Functional Interface coertion ● Composable Closures ● Method Reference
  • 38. Code
  • 40. Testing ● Spock – A better way of testing ● DSL to describe your tests in a fluent way ● Compatible with JUnit
  • 41. Testing ● AndroidSpock – Create integration tests ● Under src/androidTest/groovy ● Helpers to inject and initialize activities in your tests ● Deploys and run tests in the device
  • 42. Testing ● Robospock – Create unit tests ● Based on roboelectric 3.0 ● no DEXing or deployment time is wasted to execute your unit tests.
  • 43. Other tools ● Quality code – Codenarc ● Static analysis for Groovy ● Highly Configurable ● Completely integrated with Gradle
  • 44. References ● Links ● Android Studio – https://developer.android.com/sdk/index.html ● Lazybones – https://github.com/pledbrook/lazybones ● Grooid templates – https://github.com/mariogarcia/grooid-templates ● Swissknife – https://github.com/Arasthel/SwissKnife ● AndroidRx – https://github.com/ReactiveX/RxAndroid
  • 45. References ● Links ● Spock – http://spockframework.github.io/spock/docs/1.0/index.html ● Android Spock – https://github.com/pieces029/android-spock ● Robo Spock – http://robospock.org/ ● Gradle – https://gradle.org/ ● Groovy Lang – http://www.groovy-lang.org/
  • 46. References ● Links ● Codenarc – http://codenarc.sourceforge.net/ ● FNZ – http://mariogarcia.github.io/fnz/
  • 47. Q & A
  • 48. Common question ● Size of Groovy :grooid ?