3

This morning I've updated from SVN my Android project, added some new lines of code and tested: everything work fine.

A couple of minutes later I've tried to run again the application on my device but now Android Studio tells me:

Gradle 'iSfa' project refres failed
Error: protocol family unavailable

The content of build.gradle is:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    packagingOptions {
        exclude 'LICENSE'
        exclude 'NOTICE'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
    }

    defaultConfig {
        applicationId "it.gn.sfa"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    maven {
        url "http://JRAF.org/static/maven/2"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/android-support-v4-r10.jar')
    compile files('libs/android-support-v4.jar')
    compile 'com.fasterxml.jackson.core:jackson-core:2.3.2'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.3.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
    compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
    compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
    compile 'org.jraf:android-switch-backport:1.3.1'
}

And the content of gradle settings is:

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

    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Note: I'm using the latest version of Android Studio, release 0.8.6, and the latest version of gradle, release 0.12.2.

Deleting the .gradle folder don't solve anything.

Jongware
  • 22,200
  • 8
  • 54
  • 100
Luca
  • 823
  • 4
  • 11
  • 31
  • Some time it is related to gradle repo cache corruption. You may want to clean up the cache and do refresh dependencies for gradle. See if that works. – Ripu Daman Sep 01 '14 at 10:23
  • Btw I've deleted .gradle folder and reopened Android Studio. Now I'm waiting to see if it works. – Luca Sep 01 '14 at 10:25

4 Answers4

2

Solution found by OP:

Deleting .gradle folder, turn off Windows' firewall and rebuild project (with a complete download of the gradle repository) worked fine for me.

Jongware
  • 22,200
  • 8
  • 54
  • 100
0

The problem was of a restart required, after deleting everything and then after restart , shut down any firewall working on your system, esp when its handled by an antivirus [ my case: norton internet security] and then opening the same app and rebuilding it, then it shows no error!

ypaseka
  • 11
  • 2
0

First make sure you installed last version of Java SE Development Kit.

Then add this enviroment variable to windows variable:

_JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true;

After these steps, delete .gradle folder and close and open android studio.

Ali Motameni
  • 2,567
  • 3
  • 24
  • 34
0

I also had this problem and the referenced thread also didn't work for me. What did work was setting _JAVA_OPTIONS environment variable to make Java use IPv4.

_JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true

Reposted this solution for those who dont know how to edit Enviroment variables.
Source: https://www.youtube.com/watch?v=ivSMQ-sZ6sw

zx485
  • 28,498
  • 28
  • 50
  • 59