3

所以我刚刚将我的 Android Studio 从 3.0.1 更新到了 3.1。当我输入这个时,已经过去了 30 多分钟,Android Studio 卡在了Configure build

我做了什么:

  1. 在项目 gradle 文件中更改 gradle 版本
  2. 检查了我的互联网(它工作正常)


下面是我的屏幕截图和互联网结果

显示 Internet 统计信息和构建日志的图像


特别是这些依赖关系一直在占用。
进一步构建日志


我的项目 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
}


这是我的应用程序 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'
    }
}
4

3 回答 3

1

尝试这个 :

Android Studio 转到文件 -> 设置 -> 构建、执行、部署 -> 构建工具 -> Gradle

检查“全局 Gradle 设置”下的“离线工作”

它将减少 80% 的 gradle 构建时间。

在此处输入图像描述

并检查 gradle 依赖项

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

添加 dexOption 并给出以下 heapSize

dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
于 2018-03-28T06:30:30.237 回答
0

已修复: 我更改了Santanu此处distributionUrl所指的in 。gradle-wrapper.properties

在 gradle-wrapper.properties 中使用:-

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

而不是 4.1-all.zip 。

于 2018-03-28T09:28:33.717 回答
0

点击打开截图

启用切换离线模式解决了我的问题。检查屏幕截图以获取更多详细信息。

如果未选中,只需选择此选项即可。它以前对我有用,现在需要 25 30 分钟,现在只需要几秒钟

于 2020-09-02T12:21:48.043 回答