zoukankan      html  css  js  c++  java
  • androidstudo如何跨越这个厚厚的墙,亲测有效 Could not resolve com.android.tools.build:gradle:

    Could not resolve com.android.tools.build:gradle:4.1.0-alpha01

    这个是我报的错

    然后就是谷歌。。。访问不了

    解决方法:

    1.在本地硬盘的C:UsersLenovo.gradle下新建一个init.gradle的文件

    内容为:

    allprojects{
    repositories {
    def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
    def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
    all { ArtifactRepository repo ->
    if(repo instanceof MavenArtifactRepository){
    def url = repo.url.toString()
    if (url.startsWith('https://repo1.maven.org/maven2')) {
    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
    remove repo
    }
    if (url.startsWith('https://jcenter.bintray.com/')) {
    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
    remove repo
    }
    }
    }
    maven {
    url ALIYUN_REPOSITORY_URL
    url ALIYUN_JCENTER_URL
    }
    }
    }

    然后在你的安卓项目里build.gradle文件

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
    repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    google()
    jcenter()
    }
    dependencies {
    classpath "com.android.tools.build:gradle:4.1.0-alpha01"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
    }

    allprojects {
    repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    google()
    jcenter()

    }
    }

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

    希望可以帮助到你。
  • 相关阅读:
    批量更新sql |批量update sql
    智力测试题3
    【管理心得之二十一】管得少就是管得好
    查看sqlserver被锁的表以及如何解锁
    AD域相关的属性和C#操作AD域
    毕业5年小结一下
    WPF版公司的自动签到程序
    用友畅捷通高级前端笔试题(一)凭借回忆写出
    .NET中制做对象的副本(三)通过序列化和反序列化为复杂对象制作副本
    .NET中制做对象的副本(二)继承对象之间的数据拷贝
  • 原文地址:https://www.cnblogs.com/liglacier/p/12468254.html
Copyright © 2011-2022 走看看