漫长的gradle构建时间

时间:2018-05-19 00:48:49

标签: android android-gradle

这是一个10mb的应用程序,没什么复杂的......我无法想象为什么每个构建需要2-3分钟。我按照这里的说明操作:https://medium.com/exploring-code/how-to-decrease-your-gradle-build-time-by-65-310b572b0c43

我有Firebase Analytics,Performance和Crashlytics的基本实现。对于谷歌,你可以看到它只是appcompat,约束。除了package main import ( "fmt" ) func main() { c := nameIterator(3) for batch := range c { fmt.Println(batch) } } func nameIterator(batchSize int) <-chan []string { names := []string{"Cherry", "Cami", "Tildy", "Cory", "Ronnie", "Aleksandr", "Billie", "Reine", "Gilbertina", "Dotti"} c := make(chan []string) go func() { for i := 0; i < len(names); i++ { startIdx := i * batchSize endIdx := startIdx + batchSize if startIdx > len(names) { continue } if endIdx > len(names) { c <- names[startIdx:] } else { c <- names[startIdx:endIdx] } } close(c) }() return c } 之外,其余的依赖项看起来都很好(正在使用)。

有什么想法吗?谢谢!

APP BUILD.GRADLE

unity-ads

的build.gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "zdkapps.com.kingdomtrader"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 7
        versionName "0.0.7"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

repositories {
    maven {
        //url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
         url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo'
    }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'me.grantland:autofittextview:0.2.0'
    implementation 'com.akexorcist:RoundCornerProgressBar:2.0.3'
    implementation 'com.pnikosis:materialish-progress:1.7'
    implementation 'net.steamcrafted:materialiconlib:1.0.8'
    implementation 'com.daasuu:animateHorizontalProgressBar:0.2.3'
    implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
    implementation project(':tourguide')
    implementation 'com.google.firebase:firebase-core:12.0.1'
    implementation 'com.google.firebase:firebase-crash:12.0.1'
    implementation 'com.google.firebase:firebase-ads:12.0.1'
    implementation 'com.google.firebase:firebase-messaging:12.0.1'
    implementation project(':unity-ads')
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.facebook.stetho:stetho:1.5.0'
    implementation 'com.uphyca:stetho_realm:2.2.2'
    implementation 'com.uphyca:stetho_realm:2.1.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-perf:12.0.1'
}

apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

检查“全局Gradle设置”

下的“离线工作”

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

试试这个。

https://stackoverflow.com/a/35859572/9222720