Search code examples
androidandroid-studiogradleapkclasspath

Could not resolve all files for configuration ':app:releaseAnnotationProcessorClasspath'


I have already extracted APK from my app, but now when I try to extract from the app, it gives this error. This is despite the fact that no library has been added to the app.

Error Message:

Execution failed for task ':app:javaPreCompileRelease'. Could not resolve all files for configuration ':app:releaseAnnotationProcessorClasspath'. Could not find support-annotations.jar (com.android.support:support-annotations:25.3.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/25.3.0/support-annotations-25.3.0.jar

Possible solution:

build.gradle

buildscript {
    repositories {
        google()
        //noinspection JcenterRepositoryObsolete
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        //noinspection JcenterRepositoryObsolete
        jcenter()
        google()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            url "https://repository.aspose.com/repo/" }
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.neshan.org/artifactory/public-maven" }
        subprojects {
            project.configurations.all {
                resolutionStrategy.eachDependency { details ->
                    if (details.requested.group == 'com.google.android.gms'
                            && !details.requested.name.contains('multidex') ) {
                        details.useVersion "12.0.1"
                    }
                }
            }
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties

#Mon Jul 20 12:03:01 IRDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

No changes have been made in the code, we just want to get another output.

In general, what is the reason that Google does these things, the program that is written and output from it gives an error like this after some time and we have to make a change in the program so that it can output apk.


Solution

  • Update your gradle-wrapper.properties to

     #Wed Nov 20 09:57:01 EST 2020
     distributionBase=GRADLE_USER_HOME
     distributionPath=wrapper/dists
     zipStoreBase=GRADLE_USER_HOME
     zipStorePath=wrapper/dists
     distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
    

    Update your gradle version and replace jcenter with mavenCenter()

    buildscript {
    repositories {
        google()
        maven { url "https://jitpack.io" }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
       }
    }
    
    allprojects {
    repositories {
        mavenCentral()
        google()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            url "https://repository.aspose.com/repo/" }
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.neshan.org/artifactory/public-maven" }
        subprojects {
            project.configurations.all {
                resolutionStrategy.eachDependency { details ->
                    if (details.requested.group == 'com.google.android.gms'
                            && !details.requested.name.contains('multidex') ) {
                        details.useVersion "12.0.1"
                    }
                }
            }
        }
      }
    }
    
    task clean(type: Delete) {
      delete rootProject.buildDir
     }
    
    • Build/ clean Project
    • Sync your gradle
    • Invalidate cache and restart