Android Studio development Groovy and androidgroovy

Source: Internet
Author: User

Android Studio development Groovy and androidgroovy
Context:

This article mainly talks about how Android Studio develops Groovy and sets up the environment. I checked N more foreign languages ....

1. AS (Android Studio) itself supports Groovy, And the syntax used by Gradle is Groovy. You can also directly create a. groovy extension file in.

2. build. gradle of the Project and Module can change the directory display form to Android to identify:

Problem:

The executed groovy file will prompt that no configuration (configure) groovy

Solution: 1. Add:

buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:1.1.0'        classpath '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, add

classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6'

2. Add in build. gradle of Module layer

apply plugin: 'groovyx.grooid.groovy-android'
dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    compile 'com.android.support:appcompat-v7:21.+'    compile 'org.codehaus.groovy:groovy:2.4.0:grooid'}
That is, add a plug-in and a compile in dependencies.


3. Use the latest Android Studio1.2Beta3

Because I used an old one before, and thus cannot run.


4. Wall flip:

This is not necessary, but may be affected when groovy dependencies and AS upgrades are installed. There is no way for tianchao to be inferior in technology and management. Just use a VPN. The first VPN found by Baidu is basically fake, and the domain names are all snatched by the shanzhai.


Source code:

Source code is on my github address: https://github.com/AlbertSnow/MyGroovyProject.git

The file is app \ src \ androidTest \ java \ com \ example \ starlight \ myapplication \ policytest. groovy




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.