monoclemidi
monoclemidi

Reputation: 23

Gradle error when generating signed APK in Android Studio

I am new to Android Studio. My build compiles successfully until I try to generate a signed APK. Here is my current build.gradle file:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

I have looked at previous Stack Overflow answers and they all recommend putting the google() repository first, which I have done. I have also tried just adding "com.android.tools.lint:lint-gradle:27.1.1" to the dependencies section, but that has not worked.

Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all files for configuration ':app:lintClassPath'.
   > Could not resolve com.android.tools.lint:lint-gradle:27.1.1.
     Required by:
         project :app
      > Could not resolve com.android.tools.lint:lint-gradle:27.1.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/27.1.1/lint-gradle-27.1.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/27.1.1/lint-gradle-27.1.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve com.android.tools.lint:lint-gradle:27.1.1.

Any assistance is appreciated!

Upvotes: 2

Views: 923

Answers (2)

Timur
Timur

Reputation: 770

In my case it was a connectivity issue to google servers to download dependencies.

Make sure your Proxy, DNS or VPN Works correctly. To check the connection within Android Studio you can go to File > Settings > Appearance & Behavior > HTTP Proxy then click on Check conneciton and enter https://dl.google.com if everything works well it shows you Success message.

Upvotes: 0

Greg
Greg

Reputation: 910

If you are not actively linting a project, it might be easier just to disable it.

android {
...
  lintOptions {
      checkReleaseBuilds false
  }

}

That code should prevent that particular gradle task for running.

Upvotes: 2

Related Questions