我在Android Studio中。 我需要在项目中添加必要的依赖项。 我正在使用经过身份验证的代理。
我在项目中的gradle.properties配置如下:
systemProp.http.proxyHost=my.proxy.host
systemProp.http.proxyPort=3128
systemProp.http.proxyUser=myUser
systemProp.http.proxyPassword=myPassword
systemProp.http.nonProxyHosts=localhost
systemProp.http.auth.ntlm.domain=cha.jovenclub.cu
systemProp.https.proxyHost=my.proxy.host
systemProp.https.proxyPort=3128
systemProp.https.proxyUser=myUser
systemProp.https.proxyPassword=myPassword
systemProp.https.nonProxyHosts=localhost
systemProp.https.auth.ntlm.domain=cha.jovenclub.cu
但是当我开始同步时,下载依赖项时会返回403 Forbidden错误,具体是这样:
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.jar'.
at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:201)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.access$300(DefaultCacheAwareExternalResourceAccessor.java:54)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:89)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:81)
at org.gradle.cache.internal.ProducerGuard$AdaptiveProducerGuard.guardByKey(ProducerGuard.java:97)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:81)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoords(DefaultExternalResourceArtifactResolver.java:133)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:97)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.resolveArtifact(DefaultExternalResourceArtifactResolver.java:66)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveArtifact(ExternalResourceResolver.java:477)
Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not GET 'https://d29vzk4ow07wi7.cloudfront.net/ab88dab9bd2a3c31c4e6aaa0eb4168d13f126e9076561bb42f5f3fe80c902a78?response-content-disposition=attachment%3Bfilename%3D%22kotlin-gradle-plugin-1.2.71.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvYWI4OGRhYjliZDJhM2MzMWM0ZTZhYWEwZWI0MTY4ZDEzZjEyNmU5MDc2NTYxYmI0MmY1ZjNmZTgwYzkwMmE3OD9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFjaG1lbnQlM0JmaWxlbmFtZSUzRCUyMmtvdGxpbi1ncmFkbGUtcGx1Z2luLTEuMi43MS5qYXIlMjIiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE1NDQ1NjM0Nzd9LCJJcEFkZHJlc3MiOnsiQVdTOlNvdXJjZUlwIjoiMC4wLjAuMC8wIn19fV19&Signature=BDTjM-~StUfVLL-JmPIj4hniCxalejSsb6honjOR45AbXxxdK-u2axgBZ2cNY~sRI7jSoIlgv57tyAIOz3SI-vHYr4rjV9NqAEdU7RxwAFG8L8pGa9qvmYX8x9h6EUTncqGIedJzCwc5MK77PrApKO5eejkDwDiLsn7GQCnVKDagqdLSaa-e9WtZjecOcE89sOeWXlA3Eed907AG2FDIqbmAMVXt8qRDK3r7sKhiMZv3P6l6CG9X3kPuUB6t144BNseBYL1rvyOFJ-F-7JBT0zvP6aCLg6i13FpLnZU4MxX7sSDsFvCoOf2RXA0ottASB~MAxg6tU2R-Dq5nRcvQtQ__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA'. Received status code 403 from server: Forbidden
我不会粘贴整个错误,因为这是最重要的部分
现在,如果我获取依赖项URL(.pom或.jar文件)并将其粘贴到浏览器(firefox,chrome)中,则它将正确返回文件。 当然,浏览器也位于同一经过身份验证的代理下。
因此,浏览器没有问题,但Android Studio检索相同文件失败。
我的sysAdmin愿意为我提供帮助,但是他需要了解确切地执行操作,问题从何而来。 出于安全原因,放弃代理不是一种选择。
我非常感谢您的帮助,因为如果项目不同步,我将无法工作。
预先感谢