简体   繁体   English

Android Studio无法编译org / codehaus / groovy / runtime / StringGroovyMethods

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

Android Studio gradle is getting a groovy error as follows: Android Studio gradle出现如下错误:

Error:(36, 0) Cause: org/codehaus/groovy/runtime/StringGroovyMethods Open File 错误:(36,0)原因:org / codehaus / groovy / runtime / StringGroovyMethods打开文件

Haven't been able to resolve this for the most current version of Android Studio Canary version. 无法针对最新版本的Android Studio Canary版本解决此问题。 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. 到项目:build.gradle,我仍然有一个问题,似乎有些东西具有兼容性问题,但不确定是什么。

Here's some of my version info: 这是我的一些版本信息:

AI-141.2071668 (latest canary build) AI-141.2071668(最新的金丝雀版本)

Plugins 外挂程式

Android Support Version: 10.1.3 RC 1 Android支持版本:10.1.3 RC 1

Groovy Version: 9.0 Groovy版本:9.0

Java: Java:

jdk1.7.0_79 and jdk1.7.0_17 (tried both) jdk1.7.0_79和jdk1.7.0_17(均尝试)

Here are my gradle files: 这是我的gradle文件:

Project: build.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
}
}

allprojects { repositories { jcenter() } } allprojects {储存库{jcenter()}}

My gradle-wrapper.properties file: 我的gradle-wrapper.properties文件:

#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 distributionBase = GRADLE_USER_HOME distributionPath =包装器/ dists zipStoreBase = GRADLE_USER_HOME zipStorePath =包装器/ dists distributionUrl = https://services.gradle.org/distributions/gradle-2.2.1-all.zip

My application build.gradle file: 我的应用程序build.gradle文件:

buildscript {
repositories {
    mavenCentral()

}
dependencies {

}

} }

apply plugin: 'com.android.application' 应用插件:“ com.android.application”

android { compileSdkVersion 21 buildToolsVersion "22.0.1" 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, *.iml, build folders ... again to no resolution. 我还清理了我的.gradle文件夹* .iml,构建文件夹...再次没有解析。

I have been able to downgrade Android Studio to version 141.1903250 and it works, but I like to take advantage of the newest Android Studio versions, when they don't break anything. 我已经能够将Android Studio降级到141.1903250版本,并且可以使用,但是我喜欢利用最新的Android Studio版本,因为它们不会破坏任何内容。

I did two things to resolve the issue. 我做了两件事来解决这个问题。 Add the groovy compile to the build.gradle files and used a older version of gradle. 将groovy编译添加到build.gradle文件中,并使用了较旧的gradle版本。

I change the Project build.gradle file to the folloiwng: 我将Project 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()
}
}

I changed the module build.gradle file as follows: 我将模块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.+'

}
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 "Android Studio 无法初始化类 org.codehaus.groovy.runtime.InvokerHelper" - Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper Android Studio无法加载类'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling' - Android Studio Unable to load class 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling' android 工作室 org.codehaus.groovy。 无法投射 gradle 错误 - android studio org.codehaus.groovy. cant cast gradle error 在android studio中导入项目时出现Resolve错误,无法加载类'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling' - Getting Resolve error while importing project in android studio, Unable to load class 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling' 原因:org / codehaus / groovy / runtime / typehandling / ShortTypeHandling - Cause: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling 无法在 Android Studio 3.3 Beta 2 中下载 groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15) - Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15) in Android Studio 3.3 Beta 2 Android Studio无法编译 - Android Studio won't compile 错误无法初始化 class org.codehaus.groovy.runtime.InvokerHelper - Error Could not initialize class org.codehaus.groovy.runtime.InvokerHelper 无法初始化 class org.codehaus.groovy.runtime.InvokerHelper - Could not initialize class org.codehaus.groovy.runtime.InvokerHelper react-native run-android 不工作。 无法初始化 class org.codehaus.groovy.runtime.InvokerHelper - react-native run-android not working. Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM