简体   繁体   中英

while building a signed application “Failed to resolve: org.codehaus.groovy:groovy-all:2.4.12” error arrives

on android studio, everything works fine and also builds debug apk. But when building signed application this error arrives. I have working Internet connection and I have tried this question and questions mentioned in it.

its an exported generated by unity project so all dependencies are in one gradle file. Here is it:

    // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url "https://jitpack.io"
        }

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

allprojects {
    repositories {
        flatDir {
            dirs 'libs'
        }
        google()
        maven {
            url "https://jitpack.io"
        }
    }
}

apply plugin: 'com.android.application'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'org.codehaus.groovy:groovy-all:2.4.12'

}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        applicationId 'com.Company.MVPA'
        ndk {
            abiFilters 'armeabi-v7a', 'x86'
        }
        versionCode 1
        versionName '0.1'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'
    }

    buildTypes {
        debug {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            jniDebuggable true
        }
        release {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            signingConfig signingConfigs.debug
        }
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
        doNotStrip '*/x86/*.so'
    }

}

this line added from an answer : "implementation 'org.codehaus.groovy:groovy-all:2.4.12" but it shows the mentioned error. But without it, it shows following error (only while building a signed apk):

`Could not find org.codehaus.groovy:groovy-all:2.4.12.
Searched in the following locations:
    file:/C:/Users/RAM/AppData/Local/Android/sdk/extras/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
    file:/C:/Users/RAM/AppData/Local/Android/sdk/extras/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
    file:/C:/Users/RAM/AppData/Local/Android/sdk/extras/google/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
    file:/C:/Users/RAM/AppData/Local/Android/sdk/extras/google/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
    file:/C:/Users/RAM/AppData/Local/Android/sdk/extras/android/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
    file:/C:/Users/RAM/AppData/Local/Android/sdk/extras/android/m2repository/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
    file:/F:/Android/MVPA/Android/MVPA/libs/groovy-all-2.4.12.jar
    file:/F:/Android/MVPA/Android/MVPA/libs/groovy-all.jar
    https://dl.google.com/dl/android/maven2/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
    https://dl.google.com/dl/android/maven2/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
    https://jitpack.io/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.pom
    https://jitpack.io/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar
Required by:
    project : > com.android.tools.lint:lint-gradle:26.2.1
`

How to build a signed apk solving this problem?

在此处输入图片说明

add jcenter to repositories, among implementation line.

allprojects {
    repositories {
        jcenter() //this
        flatDir {
            dirs 'libs'
        }
        google()
        maven {
            url "https://jitpack.io"
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM