问题:
当我尝试在 Android Studio 3.3 Beta 2 中构建我的 Kotlin 项目的发布版本的时,它会在吐出一些错误后随机卡住10到16分钟。
运行gradle/assemble
,它显示以下错误:
> Task :app:lintVitalRelease FAILED
:app:lintVitalRelease (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 8 mins 23.222 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all files for configuration ':app:lintClassPath'.
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15)
> Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> Connection reset
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
我到目前为止已经尝试过的内容
但它根本不会下载并卡住。
项目Gradle设置
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0"
classpath 'com.android.tools.build:gradle:3.4.0-alpha02'
//workaround for Dagger2 > 2.16
classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
我不知道是什么原因导致它停止下载或不允许它下载groovy文件,但我被卡在这里,无法发布我的应用程序:(
最佳答案
当我今天将 Android Studio 更新为 ver3.3 时,我遇到了此问题,这是我的错误:
"Execution failed for task ':app:lintVitalRelease"....
"org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath"
.....
"Could not download junit.jar (junit:junit:4.12)"
.....
"org.gradle.api.resources.ResourceException: Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'."
.....
"org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar'"
.....
这次是' junit.jar ',而30分钟前是' groovy-all.jar '...。我认为互联网存在某些问题,因此我尝试了很多次,并等待了数小时...
但是当我在等待时搜索'执行失败的任务':app:lintVitalRelease '时,我发现了另一个解决方案,将以下行添加到 app \ build.gradle 中的 android {}
"lintOptions {
checkReleaseBuilds false
abortOnError false
}"
我不知道为什么,但是行得通,红线消失了...