Android Studio3.5在编译项目出现连接不上gradle该怎么办?

------------恢复内容开始------------

报错原因:

Could not get resource ''

网上说的解决方法都无效,增加了SS代理也无


折腾了一会儿,好像可以了。

  1. 把项目中的build.gradle中google()和jcenter()注释掉,换成阿里云的就可以了。
  2. 将Android Studio中所有的代理全部取消
  3. 另外将~/.gradle/gradle.properties中关于代理的内容全部注释掉。

build.gradle内容改为如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        //google()
        //jcenter()
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

------------恢复内容结束------------

posted @ 2020-03-20 22:49  郑州谷多软件  阅读(496)  评论(0编辑  收藏  举报