Developing a native Android App using Groovy
Many of us Java developers have been curious about being able to develop native android app using groovy for a long time. This topic has been discussed in stackoverflow for years. In GR8Conf Europe this year, Cédric Champeau showed Groovy Support for Android starting Groovy 2.4.
In this post we will build a simple Android app using groovy.
Create a new Android app using Android Studio (0.8.6 was the latest version at the time of writing).
Edit the “build.gradle” of your “app” module and add the following:
You will need to add groovy as a dependency as well.
With these changes you now can start using groovy.
Let’s rename the Activity “.java” to “.groovy” file.
Here is the content of the activity file that is written in groovy
You can build and deploy the app on your device.
You can checkout the project in github. https://github.com/manijshrestha/GroovyDroidExample