我是离线下载gradle-4.6的,已经手动配置在C盘用户的.gradle下了,编译时还是出现Connection timed out: connect。网络换了好几个了,防火墙也关了,还是这样子。真的不知道怎么回事,快疯了

解决方案 »

  1.   

    把下面内容添加到你的项目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/' }
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0'
    //        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
            // 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 "https://jitpack.io" }
            jcenter()
            google()
        }
    }task clean(type: Delete) {
        delete rootProject.buildDir
    }//ext {
    //    sdkVersion = 27
    //    supportLibVersion = '26.1.0'
    //}
      

  2.   

    你不要手动配置,直接使用AS 自动配置,从github.com 随便下载一个android 项目,然后打开之后让android 自动配置你的gradle,然后再打开你的项目,如果还有问题,那么可能就不是你的gradle文件而是你的项目配置问题了,花不了几分钟,试试吧