Microsoft Azure DevOps管道失败,Gradle Android中出现连接重置错误



我在MS Azure DevOps中运行我的CI管道,该管道总是以相同的错误失败。

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':feature-onboarding:kaptGenerateStubsDebugKotlin'.
> Could not resolve all files for configuration ':feature-onboarding:DebugCompileClasspath'.
> Could not download okio-1.17.4.jar (com.squareup.okio:okio:1.17.4)
> Could not get resource 'https://jcenter.bintray.com/com/squareup/okio/okio/1.17.4/okio-1.17.4.jar'.
> Could not GET 'https://jcenter.bintray.com/com/squareup/okio/okio/1.17.4/okio-1.17.4.jar'.
> Connection reset

我尝试过多种方法:

  1. 将内存大小增加到8GB
  2. 向grade.properties文件添加额外特性:
org.gradle.internal.http.connectionTimeout=300000
org.gradle.internal.http.socketTimeout=300000
org.gradle.internal.repository.max.retries=10
org.gradle.internal.repository.initial.backoff=500
  1. 使用macOS-10.15、macOS-10.14、macOS最新版本运行
  2. 在没有后台程序的情况下运行gradleW

额外:使用的单元测试模板:

parameters:
gradleCommand: 'testDebugUnitTest'
steps:
- task: Gradle@2
displayName: 'Run Tests'
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx8192m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: '${{ parameters.gradleCommand }} --no-daemon --no-parallel --stacktrace'

但它们似乎都不起作用,错误仍然存在。我们如何解决这个问题?

以防万一-尽量不要使用JCenter,不要在Maven Central 之前使用

Jfrog逐渐离开JCenter,这会带来问题,尤其是Azure DevOps管道。

我更改了存储库的顺序,先检查Maven Central,然后检查JCenter,它解决了问题。

https://onesignal.com/blog/android-migrate-jcenter-to-maven-central/

最新更新