Context:
The main thing about Android Studio is how to develop groovy, the environment, the most disgusting. I have checked more than n foreign languages ....
1.AS (Android Studio) natively supports groovy, and Gradle's syntax is groovy. You can also create a. Groovy suffix document directly in as.
2.Project, module Build.gradle can change the display form of the directory to Android to identify:
Problem:
The groovy files that are executed will prompt for no configuration (configure) Groovy
Workaround:
1. In the project layer Build.gradle, add:
Buildscript { repositories { jcenter () } dependencies { ' Com.android.tools.build:gradle : 1.1.0 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6 ' //Note:do not place your application dependencies here; they belong //In the individual module Build.gradle files }}
That is, on the original basis, add
' org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6 '
2. Add the Build.gradle in the module layer
plugin ' groovyx.grooid.groovy-android '
dependencies { Compile filetree (dir' Libs 'include: [' *.jar ']) ' com.android.support:appcompat-v7:21.+ ' org.codehaus.groovy:groovy:2.4.0:grooid ' }
That means adding a plugin and adding a compile to dependencies.
3. To use the latest Android STUDIO1.2BETA3
Because I used to be old, resulting in the inability to run.
4. Turn over the wall:
This is not required, but may be affected when installing groovy's dependencies and as upgrades. No way celestial technology, management is inferior to people. With a VPN on the line, the main Baidu search for the first VPN is basically fake, the domain names have been the fake squatting.
Source:
Source on my github address is: https://github.com/AlbertSnow/MyGroovyProject.git
File is App\src\androidtest\java\com\example\starlight\myapplication\groovytest.groovy
Android Studio Development Groovy