saeid ezzati
saeid ezzati

Reputation: 891

I have some errors in gradle sync - android

I have android studio v1.4 and have some errors in gradle sync.

in first I gave this Error:

Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.

I searched in google and found that I must turn on offline work in global gradle settings

after that I gave this Error:

No cached version listing for com.android.databinding:dataBinder:1.+ available for offline mode.

for solving this I found that I must manual download the intended file and add it to android studio.

but I dont know exactly what file I must download ? and from where ? and how add to android studio ?

build.gradle(project: test) :

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.+'
        classpath "com.android.databinding:dataBinder:1.+"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

build.gradle (module: app) :

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example.saeid7laptop.test"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    maven {
        url "https://jitpack.io"
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile project(':Material-Animations-master')
}

Upvotes: 0

Views: 226

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191854

The solution

The problem ended up being solved by the proxy settings in Android Studio. Those can be found in the Preferences window and it looks like this.

This post was also provided as a solution.

proxy prefs


To include a JAR file

I found that I must manual download the intended file and add it to android studio, but I dont know exactly what file I must download?

The error tells you to download com.android.databinding:dataBinder (any version)

and from where?

Here is the latest version on JCenter. Just download the JAR file using the "Files" link towards the middle-right of the page.

how add to android studio ?

Since you have this in your build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

Just move the JAR file into the libs/ folder of the module you need to use the DataBinding library in.

Upvotes: 1

Related Questions