When I was compiling the AS project, I found that the Kotlin plugin could not be loaded normally all the time. After receiving and searching, I solved the problem and recorded and shared it again, hoping to help you

Compilation problems

> Could not resolve all artifacts for configuration ':classpath'. > Could not resolve Org. Jetbrains. Kotlin: kotlin - gradle - plugin: 1.3.60. Required by: project: > Could not resolve org. Jetbrains. Kotlin: kotlin - gradle - plugin: 1.3.60. > Could not get the resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.60/kotlin-gradle-plugin-1.3.60.po m'. > Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.60/kotlin-gradle-plugin-1.3.60.po m'. Received status code 400 from server: Bad Request > Could not resolve org. Jetbrains. Kotlin: kotlin - gradle - plugin: 1.3.60. > Could not get the resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.60/kotlin-gradle-plugin-1.3.60.pom'. > Could Not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.60/kotlin-gradle-plugin-1.3.60.pom'. Received status code 400 from server: Bad RequestCopy the code

Thinking analysis

Received status code 400 from server: Bad Request Request timeout SSL peer shut down INCORRECTLY

No matter how prompted, most of them are network problems and there is no way to get.pom/jar files from the Internet.

  • Copy the URL to your browser and see if the. Pom /jar file can be downloaded.

The final question might be:

  • 1. If the connection is faulty, for example, the file is not available, you can view it yourself

Kotlin plugin address: jcenter.bintray.com/org/jetbrai…

  • 2. There are environmental problems.

In normal cases, the AS warehouse configuration is AS follows:

  google()
  jcenter()
Copy the code

Then the existence of the domestic wall is unable to access the foreign address, need to go over the wall, because of the instability of the domestic channel, sometimes even if the wall is not successful, will report timeout, SSL and other problems.

If the wall still does not solve the problem: then do not climb the wall, we need to configure mirror to solve the problem. (in order to improve the download speed of the jar package can be configured) configuration method is at the root of the build. Add mirror gradle warehouse, usually we choose ali maven.aliyun.com/nexus/conte…

Buildscript {ext.kotlin_version = '1.3.72' ext.coroutine_version = '1.0.0' Repositories {Google () // jCenter () maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } } dependencies { classpath 'com. Android. Tools. Build: gradle: 3.5.3' classpath "org. Jetbrains. Kotlin: kotlin - gradle - plugin: $kotlin_version"}} allprojects { repositories { google() //jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url  'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } } }Copy the code

If the problem persists after the mirror address is configured, it is most likely caused by the proxy configuration.

1. Open the HttpProxy interface of AndroidStudio and check whether the proxy configuration exists

Properties C:\Users\ XXX \.gradle\gradle.properties C:\Users\ XXX \.gradle\gradle.properties

SystemProp. HTTPS. ProxyPort = 8580 systemProp. HTTP. ProxyHost = 127.0.0.1 systemProp. HTTPS. ProxyHost = 127.0.0.1 systemProp.http.proxyPort=8580Copy the code

If a proxy is configured, the proxy server is unusable, of course. Delete the agent configuration from the gradle.properties file and synchronize the project.

Thinking summary: when encountering problems, we should clear up our thoughts, analyze the reasons and solve them, rather than blindly searching for answers on the Internet. Exercise their ability to think, analyze and solve problems.