Question

[Solved] android- Gradle: An issue occurred configuring root project android studio

I migrated from eclipse to android studio. I’ve create a new project and I want to run it on genymotion. When I press run icon, it begins to compile and give me this error :

Error:Gradle: A problem occurred configuring root project 'Khabar'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:1.1.0.
     Required by:
         :Khabardar:unspecified
      > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.1.0/gradle-1.1.0.pom'.
         > d29vzk4ow07wi7.cloudfront.net

This is some parts of my build.gradle :

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "example.ir.khabar"
        minSdkVersion 8
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

build.gradle in root :

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "example.ir.khabar"
        minSdkVersion 8
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile files('libs/universal-image-loader-1.8.4-with-sources.jar')
}

Could you help me? my gradle version is gradle-2.2.1-all

Solution #1:

For me, the solution was to add the http url for jcenter, instead of https:

buildscript {
    repositories {
        jcenter {
            url "http://jcenter.bintray.com/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
Respondent: mohamad bagheri

Solution #2:

In addition to Al’s answer, I also had to put the url inside allprojects:

allprojects {
    repositories {
        jcenter {
            url "http://jcenter.bintray.com/"
        }
    }
}
Respondent: Al Lelopath

Solution #3:

I was having the same issue on Ubuntu Mate 18.04. I was able to fix it by replacing ibm-java80-jdk & ibm-java80-jre with openjdk. Also, I did update my DNS to cloudflare DNS. But I don’t think it had anything to do with the fix.

Respondent: Simon

Solution #4:

add google() in your gradle inside the repositories section will solve your problem..

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

    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Respondent: ipmanlk

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy