4

So I just updated my Android Studio to 3.1 from 3.0.1. As I am typing this, over 30 minutes have been passed and Android Studio is stuck at Configure build.

What have I done:

  1. change gradle version in project gradle file
  2. checked my internet (it is working fine)


Below is a snapshot of my screen with internet results

image showing internet stats along with build log


These dependencies in particular are taking all the time.
further build logs


My project build.gradle

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

buildscript {

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

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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


And here is my application build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.smk.carsapp"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
configurations {
    all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:exifinterface:27.1.0'
    implementation 'com.android.support:support-v13:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    implementation 'com.jsibbold:zoomage:1.1.0'
    implementation 'com.siclo.ezphotopick:library:1.0.8'
    //    TEST
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation files('libs/ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar')
}
repositories {
    mavenCentral()
    maven {
        url 'https://dl.bintray.com/siclo/SicloAndroidOSS'
    }
}

3 Answers3

1

try this :

Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle

Check the 'Offline work' under 'Global Gradle settings'

It will reduce 80% gradle build time.

enter image description here

and check gradle dependencies

buildscript {
  dependencies {
     classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
 }
 }

Add dexOption and give the following heapSize

dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
Android Geek
  • 8,956
  • 2
  • 21
  • 35
0

Fixed: I changed the distributionUrl in gradle-wrapper.properties as pointed by Santanu here.

In gradle-wrapper.properties use this :-

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

Instead of 4.1-all.zip .

0

Click to open ScreenShot

Enable Toggle Offline Mode Solved my issue. Check screenshot for more details.

Just select this one if it's not selected. its worked for me previously its take 25 30 minutes now it only takes a few seconds

Rehan
  • 21
  • 4