Не удалось разрешить com. android .tools.build: gradle: 3.0.1; - PullRequest
0 голосов
/ 22 апреля 2020

Я использую это в gradle-properties:

**distributionUrl=https\://services.gradle.org/distributions/gradle-4.1- 
all.zip**

build.gradle:

**buildscript {
        repositories {
            google()
            mavenCentral()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'com.google.gms:google-services:3.0.0'
            // NOTE: Do not place your application dependencies here; they 
             //belong
            // in the individual module build.gradle files
        }
    }
    allprojects {
        repositories {
            jcenter()
             maven {
                url 'https://maven.google.com'
            }
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }**

У меня есть ОШИБКА:

**failed org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.
    org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.0.1.
    org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
    org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0`enter code here`.1.pom'.
    org.apache.http.conn.HttpHostConnectException: Connect to dl.google.com:443 [dl.google.com/172.217.160.238] failed: Connection timed out: connect
    java.net.ConnectException: Connection timed out: connect**

I обновил свойства gradle.properties gradle 5.6.4:

**distributionBase=GRADLE_USER_HOME
            distributionPath=wrapper/dists
            zipStoreBase=GRADLE_USER_HOME
            zipStorePath=wrapper/dists
            distributionUrl=https\://services.gradle.org/distributions/gradle- 
    5.6.4-all.zip**

И я добавил maven {url "https://jitpack.io"} в репозитории gradle:

**buildscript {
        repositories {
            google()
            mavenCentral()
            jcenter()
            maven { url "https://jitpack.io" }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.6.1'
            classpath 'com.google.gms:google-services:3.0.0'
            // NOTE: Do not place your application dependencies here; 
           //they belong
            // in the individual module build.gradle files
        }
    }
    allprojects{
        repositories {
            jcenter()
            maven {
                url 'https://maven.google.com'
            }
            maven { url "https://jitpack.io" }
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir
    }**

Я установил прокси и установил его, но проблема осталась.

1 Ответ

0 голосов
/ 22 апреля 2020

Попробуйте использовать URL-адрес дистрибутива как:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

и в build.gradle: project:

   buildscript {
        repositories {
            google()
            mavenCentral()
            jcenter()
            maven { url "https://jitpack.io" } // add this line.

        }
        dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
            classpath 'com.google.gms:google-services:3.0.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    allprojects {
        repositories {
            jcenter()
             maven {
                url 'https://maven.google.com'
            }
            maven { url "https://jitpack.io" } // add this line.

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

Вам необходимо добавить maven { url "https://jitpack.io" } // add this line. в проект build.gragle В Чтобы решить эту проблему.

...