找不到org.codehaus.groovy:groovy-all:2.4.12

Ant*_*nto 0 groovy android gradle android-gradle-plugin

更新android studio和gradle后,我无法再编译(在发布模式下)我的应用程序.当我尝试生成APK时,我收到此错误:

找不到org.codehaus.groovy:groovy-all:2.4.12.在以下位置搜索:file:/Users/antonioleva/Library/Android/sdk/extras/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom文件:/ Users /antonioleva/Library/Android/sdk/extras/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar文件:/ Users/antonioleva/Library/Android/sdk/extras /google/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom文件:/ Users/antonioleva/Library/Android/sdk/extras/google/m2repository/org/codehaus /groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar文件:/Users/antonioleva/Library/Android/sdk/extras/android/m2repository/org/codehaus/groovy/groovy-all/2.4 .12/groovy-all-2.4.12.pom文件:/Users/antonioleva/Library/Android/sdk/extras/android/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4 .12.jar https://maven.google.com/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom https://maven.google.com/org/codehaus /groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar 必需:projec t:> com.android.tools.lint:lint-gradle:26.1.3

这是我的傻瓜:

    buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
    }
}
apply plugin: 'android'

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation('com.android.support:multidex:1.0.1') {
        exclude module: 'support-v4'
        exclude module: 'support-fragment'
        exclude module: 'internal_impl-23.0.1'


    }
    implementation('com.android.support:support-v4:23.0.1') {
        exclude module: 'support-v4'
        exclude module: 'support-fragment'
        exclude module: 'internal_impl-23.0.1'
    }


    implementation('com.android.support:appcompat-v7:23.0.1') {
        exclude module: 'support-v4'
        exclude module: 'internal_impl-23.0.1'
        exclude module: 'support-fragment'
    }
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    //implementation 'org.codehaus.groovy:groovy-all:2.4.12'
}

android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        multiDexEnabled true
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude '...'
    }



    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        androidTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}
Run Code Online (Sandbox Code Playgroud)

Abn*_*cio 16

为我工作得很好

的build.gradle

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
        }
        google()
    }
    ...
}
...
repositories {
    google()
    jcenter()
    maven {
        url "https://jitpack.io"
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序/的build.gradle

dependencies {
    implementation 'org.codehaus.groovy:groovy-all:2.4.12'
}
Run Code Online (Sandbox Code Playgroud)


fre*_*sko 5

我遇到了同样的问题,一切都正确安装,但找不到;我还刷新了 IntelliJ 中可刷新的所有内容;我删除了项目中的所有临时文件夹。一切都没有用。

\n\n

然后我从终端解决了这样的问题:

\n\n
gradlew build --refresh-dependencies\n
Run Code Online (Sandbox Code Playgroud)\n\n

这解决了这个问题。

\n\n

在万不得已的情况下,你可以删除gradle使用的全局缓存文件夹的内容(在我的例子中没有必要);例如可以是这样的:

\n\n
C:\\Users\\USERNAME\\.gradle\\caches\n
Run Code Online (Sandbox Code Playgroud)\n\n

我希望,您可以帮助我,\xc4\x89ar 我可以多节奏。

\n