Android Studio 无法编译 org/codehaus/groovy/runtime/StringGroovyMethods
Android Studio won't compile org/codehaus/groovy/runtime/StringGroovyMethods
Android Studio gradle 出现如下 groovy 错误:
错误:(36, 0) 原因:org/codehaus/groovy/runtime/StringGroovyMethods
打开文件
无法为最新版本的 Android Studio Canary 版本解决此问题。我已经添加
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
项目:build.gradle 我仍然有一个问题,似乎有兼容性问题,但不确定是什么。
这是我的一些版本信息:
AI-141.2071668(最新金丝雀版本)
插件
Android支持版本:10.1.3 RC 1
Groovy版本:9.0
Java:
jdk1.7.0_79 和 jdk1.7.0_17(都试过了)
这是我的 gradle 文件:
项目: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
}
}
所有项目{
存储库{
中心()
}
}
我的gradle-wrapper.properties文件:
#Wed Apr 10 15:27:10 PDT 2013
分布基础=GRADLE_USER_HOME
分布路径=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
我的申请build.gradle文件:
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
应用插件:'com.android.application'
android{
编译SDK版本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'
}
我也清理了我的 .gradle 文件夹,*.iml,build 文件夹...再次没有解决。
我已经能够将 Android Studio 降级到版本 141.1903250 并且它可以工作,但我喜欢利用最新的 Android Studio 版本,因为它们不会破坏任何东西。
我做了两件事来解决这个问题。将 groovy 编译添加到 build.gradle 文件并使用旧版本的 gradle.
我将项目 build.gradle 文件更改为以下内容:
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
我更改了模块 build.gradle 文件如下:
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
// classpath 'com.android.tools.build:gradle:0.10.+'
// classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.8'
// classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
Android Studio gradle 出现如下 groovy 错误:
错误:(36, 0) 原因:org/codehaus/groovy/runtime/StringGroovyMethods 打开文件
无法为最新版本的 Android Studio Canary 版本解决此问题。我已经添加
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
项目:build.gradle 我仍然有一个问题,似乎有兼容性问题,但不确定是什么。
这是我的一些版本信息:
AI-141.2071668(最新金丝雀版本)
插件
Android支持版本:10.1.3 RC 1
Groovy版本:9.0
Java:
jdk1.7.0_79 和 jdk1.7.0_17(都试过了)
这是我的 gradle 文件:
项目: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
}
}
所有项目{ 存储库{ 中心() } }
我的gradle-wrapper.properties文件:
#Wed Apr 10 15:27:10 PDT 2013
分布基础=GRADLE_USER_HOME 分布路径=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
我的申请build.gradle文件:
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
应用插件:'com.android.application'
android{ 编译SDK版本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'
}
我也清理了我的 .gradle 文件夹,*.iml,build 文件夹...再次没有解决。
我已经能够将 Android Studio 降级到版本 141.1903250 并且它可以工作,但我喜欢利用最新的 Android Studio 版本,因为它们不会破坏任何东西。
我做了两件事来解决这个问题。将 groovy 编译添加到 build.gradle 文件并使用旧版本的 gradle.
我将项目 build.gradle 文件更改为以下内容:
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
我更改了模块 build.gradle 文件如下:
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
// classpath 'com.android.tools.build:gradle:0.10.+'
// classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.8'
// classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}