首页 > 移动平台 > 详细

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

时间:2020-03-21 00:29:37      阅读:108      评论:0      收藏:0      [点我收藏+]

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

报错原因:

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
}

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

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

原文:https://www.cnblogs.com/wx18638101223/p/12535527.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!