Groovy on Android (as of 2016)
- 3. My Tech Stacks
• Android, Spring Boot, AngularJS, Java in
general, Groovy related frameworks like Gaelyk
and Grails, etc.
- 15. Compilation Options
androidGroovy {
options {
configure(groovyOptions) {
encoding = 'UTF-8'
forkOptions.jvmArgs = ['-noverify'] // maybe necessary if you
use Google Play Services
}
sourceCompatibility = '1.7' // as of 0.3.9 these are
automatically set based off the android plugin's
targetCompatibility = '1.7'
}
}
- 16. Domain Classes
• Groovy AST Transformation (AST means Abstract Syntax Tree,
which is basically an abstract representation of code / any
syntactic structure. A transformation is an action modifying this
tree)
@AutoExternalize
@ToString
@Immutable
@InheritConstructors
- 21. Libraries
• Fluent API
• JsonSlurper and XMLSlurper
• Groovy AST Transformation
• SwissKnife (similar with Butterknife by Jake Wharton)
More info: http://groovy-almanac.org/ and
http://melix.github.io/blog/2014/06/grooid.html
- 24. Downsides
• Doesn’t fully work with Android Studio in terms of
Goto File implementation (workaround - double
tap Shift to search and go to file)
• Right click on package, select New > Create
Groovy Class doesn’t appear.
• Packaged APK file is huge (due to the hug
grooid jar size)