【问题标题】:Does changing the build tools version make gradle build the project much slower?更改构建工具版本会使 gradle 构建项目慢得多吗?
【发布时间】:2016-06-24 06:30:08
【问题描述】:

最近我更改了构建工具版本以适应新功能,但我的 gradle 构建速度非常慢。我可以同步项目,它将在大约 5 分钟内构建,但之后另一个构建开始,已经持续了 30 分钟以上。 我从构建工具版本“19.1.0”升级到“23.0.1”。

当前的 build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 17
    buildToolsVersion '23.0.1'
    defaultConfig {
        applicationId "com.example.macuser.itestify"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.android:facebook-android-sdk:4.13.1'
    compile 'com.google.android.gms:play-services-identity:9.0.2'
}

以前的 build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 17
    buildToolsVersion '19.1.0'
    defaultConfig {
        applicationId "com.example.macuser.itestify"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:19.1.0'
}

是什么导致它构建得非常缓慢?我该如何解决? 注意我正在运行 Android Studio 1.4

编辑:在等了很久之后,我得到了这个错误

9:45:07 AM Sending jdwp tracking request failed!
9:45:07 AM Adb connection Error:EOF
9:45:07 AM Connection attempts: 1

【问题讨论】:

  • 它可能正在下载该版本的构建工具
  • 我已经有了!这就是它如此奇怪的原因。
  • 为什么你不应该在离线模式下破坏它,所以它需要花费太多时间来构建。这个链接可能对你有用stackoverflow.com/questions/28712025/…
  • 我尝试将其置于离线模式,我什至尝试将带有并行处理变量的 gradle.properties 文件添加为 true.. 不走运

标签: android android-studio android-gradle-plugin android-build


【解决方案1】:

我不认为它会减慢gradle构建速度。我也尝试通过更改版本来构建应用程序。它对时间没有影响。

【讨论】:

  • 但问题是,当我将它恢复到以前的 build.gradle 配置时,它构建得很好..
  • 我遇到了同样的问题。当我使用较新的版本 24.0.0 构建项目时,它会抛出一个错误,但它在 23.0.3 版本上对我来说很好。
  • 他们都花了很长时间来构建
  • 你的电脑是什么规格的?
  • MAC OSX 10.6.8, 4gb RAM, 2.16GHz Intel Dual Core.. 有足够的信息吗?
猜你喜欢
  • 2014-04-10
  • 2015-04-26
  • 2014-02-03
  • 2015-12-09
  • 1970-01-01
  • 1970-01-01
  • 2021-03-31
  • 1970-01-01
  • 2012-06-24
相关资源
最近更新 更多