无法解析com.android.tools.build:gradle:3.2.1 [英] Could not resolve com.android.tools.build:gradle:3.2.1

查看:566
本文介绍了无法解析com.android.tools.build:gradle:3.2.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很长一段时间我都没有开发任何Android应用程序(大约5个月),现在我又返回了nativescript.当我使用nativescript创建第一个应用程序时,遇到了以下问题:

There is long time I had not developed any Android application (about 5 months) and now I have came back with nativescript. When I have created my first app using nativescript, I encountered this issue:

执行前应准备的挂钩 C:\ Data \ ProjectFiles \ NativeScript \ HeavenlyMinutes \ hooks \ before-shouldPrepare \ nativescript-dev-webpack.js 跳过准备.正在建立专案... Gradle建立中...

Executing before-shouldPrepare hook from C:\Data\ProjectFiles\NativeScript\HeavenlyMinutes\hooks\before-shouldPrepare\nativescript-dev-webpack.js Skipping prepare. Building project... Gradle build...

失败:构建失败,并出现异常.

FAILURE: Build failed with an exception.

  • 出了什么问题:配置根项目"HeavenlyMinutes"时出现问题.

  • What went wrong: A problem occurred configuring root project 'HeavenlyMinutes'.

无法解析配置':classpath'的所有工件. 无法解析com.android.tools.build:gradle:3.2.1. 要求者: 项目 : 无法解析com.android.tools.build:gradle:3.2.1. 无法获取资源' https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom ". 无法获取' https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom ". 连接到jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150]失败:连接超时: 连接 无法解析com.android.tools.build:gradle:3.2.1. 无法获取资源' https ://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom ". 无法获取' https: //jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom ". 连接到jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150]失败:连接超时: 连接

Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.2.1. Required by: project : Could not resolve com.android.tools.build:gradle:3.2.1. Could not get resource 'https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect Could not resolve com.android.tools.build:gradle:3.2.1. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行,以获取更多日志输出.与--scan一起运行以获得完整的见解.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    https://help.gradle.org

    在48秒钟内构建失败,命令gradlew.bat失败,退出代码为1

    BUILD FAILED in 48s Command gradlew.bat failed with exit code 1

    因此,我参考了我最近使用Android Studio创建和开发的项目.因此问题也在那里.我已经在gradle上测试了多种配置,例如下面提到其中两个:

    So I have refered to my last projects created and developed using Android Studio. So the problem was there too. I have tested multiple configurations on gradle and for example two of them are mentioned below:

    gradle.wrapper.properties

    gradle.wrapper.properties

    #Thu Sep 27 11:34:03 EEST 2018
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
    

    build.gradle(项目依赖项)

    build.gradle (project dependencies)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
    
        repositories {
            google()
            mavenCentral()
            maven { url 'https://maven.google.com' }
            gradlePluginPortal()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
        }
    }
    
    allprojects {
        repositories {
            google()
            mavenCentral()
            maven { url 'https://maven.google.com' }
            gradlePluginPortal()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    两个

    gradle.wrapper.properties

    Two

    gradle.wrapper.properties

       #Thu Sep 27 11:34:03 EEST 2018
        distributionBase=GRADLE_USER_HOME
        distributionPath=wrapper/dists
        zipStoreBase=GRADLE_USER_HOME
        zipStorePath=wrapper/dists
        distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
    

    build.gradle(项目依赖项)

    build.gradle (project dependencies)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
    
        repositories {
            google()
            mavenCentral()
            maven { url 'https://maven.google.com' }
            gradlePluginPortal()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
        }
    }
    
    allprojects {
        repositories {
            google()
            mavenCentral()
            maven { url 'https://maven.google.com' }
            gradlePluginPortal()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    他们都没有帮助我.在我的android项目之前,我认为问题出在其他地方.

    and none of them helped me. As my android projects were working before, I think the problem is somewhere else.

    请注意,链接 https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar https在错误中提到的://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom ,是无法访问的链接,是可下载的抛出Internet浏览器.因此,我认为一种可能的解决方案是手动下载它们并将它们放置在项目中的某个位置(但是我已经搜索了很多方法,但是没有找到任何东西).

    Note that the links https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar and https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom that are mentioned in the errors as unreachable links, are downloadable throw internet browser. So I think one possible solution will be to download them manually and put them somewhere in the project (but I have searched a lot how to do this and didn't find anything).

    推荐答案

    这与制裁有关.我尝试了一些制裁措施,最后 shecan 解决了我的问题.

    That was all about sanctions. I have tried some sanction-breaker and at last shecan solved my issue.

    此答案仅对伊朗用户有用.

    This answer will be useful only for Iranian users.

    这篇关于无法解析com.android.tools.build:gradle:3.2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆