Android Studio won't compile org/codehaus/groovy/runtime/StringGroovyMethods

Android Studio gradle is getting a groovy error as follows:

Error:(36, 0) Cause: org/codehaus/groovy/runtime/StringGroovyMethods
Open File

Haven’t been able to resolve this. I have added

classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'

to the Project: build.gradle and I still have an issue, seems like something has a compatibility issues, but not sure what.

Here’s some of my version info:

AI-141.2071668 (latest canary build)

Plugins

Android Support Version: 10.1.3 RC 1

Groovy Version: 9.0

Java:

jdk1.7.0_79 and jdk1.7.0_17 (tried both)

Here are my gradle files:

Project: build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.2.3'

    classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

My gradle-wrapper.properties file:

#Wed Apr 10 15:27:10 PDT 2013

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip

My application build.gradle file:

buildscript {
repositories {
    mavenCentral()

}
dependencies {

}

}

apply plugin: ‘com.android.application’

android {
compileSdkVersion 21
buildToolsVersion “22.0.1”

defaultConfig {
    applicationId 'com.me.app'
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1101
    versionName "1.1.01"
    multiDexEnabled = true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

}
packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}
productFlavors {
    developercode {
        minSdkVersion 16
        applicationId 'com.me.app'

        targetSdkVersion 21
        versionCode 1101
        versionName '1.1.01'
    }
    eridesharecode {
        minSdkVersion 16
        applicationId 'com.me.app'
        targetSdkVersion 21
        versionCode 1101
        versionName '1.1.01'
    }
}
dexOptions { javaMaxHeapSize "2g" }
compileOptions {
    encoding "UTF-8"
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.squareup.okio:okio:1.1.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'de.keyboardsurfer.android.widget:crouton:1.+@aar'
compile 'com.joanzapata.android:android-iconify:1.0.6'
compile 'com.tundem.aboutlibraries:library:4.0.1@aar'
compile 'com.squareup.retrofit:retrofit:1.7.1'
provided 'com.squareup.dagger:dagger:1.2.+'
compile 'com.google.android.gms:play-services:+'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'de.greenrobot:eventbus:2.1.0'
compile files('libs/nineoldandroids-2.4.0.jar')
provided 'com.squareup.dagger:dagger-compiler:1.2.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.joanzapata.mapper:simple-mapper:1.0.10'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'javax.mail:mail:1.4.7'

}

I have also cleaned out my .gradle folder, build folders … again to no resolution.

@CedricChampeau any ideas?

No idea on my side, but using the backports jar shouldn’t be necessary: it’s meant for Gradle plugins that were compiled with a newer version of Groovy and that execute on an older runtime. A full stack trace would certainly help here. I notice you are using an RC version of the Android Support plugin and a development version of Android Studio, so it might well be unstable.