android studio build error : firewall blocking gradle access to studio

梦想的初衷 提交于 2019-12-13 09:11:56

问题


My firewall is not letting me access the the gradle . is there a way around this?

FAILURE: Build failed with an exception.

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

    Could not resolve all dependencies for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:1.5.0. Required by: :MyApplication3:unspecified Could not resolve com.android.tools.build:gradle:1.5.0. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'. Connection to https://jcenter.bintray.com refused

here is my gradle file

apply plugin: 'com.android.application'
final def extension = android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.tataelxsi.snigdha.myapplication"
        minSdkVersion 8
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguardandroid.txt'), 'proguard-rules.pro'
        }
    }
}
extension
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.android.support:design:23.2.1'
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'
}

回答1:


You just open your root gradle file and then set your class path in dependencies block like this but be sure that class path set in your project gradle file not in your modual gradle file i hope this will help you

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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



回答2:


  1. go to control panel
  2. choose system and security
  3. you will see windows firewall option choose
  4. allow a program through windows firewall

image here

now uncheck the android studio and click ok



来源:https://stackoverflow.com/questions/36614510/android-studio-build-error-firewall-blocking-gradle-access-to-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!