簡體   English   中英

Gradle構建時間長

[英]Long gradle build time

這是一個10mb的應用程序,沒有什么復雜的..我無法想象為什么每個構建都需要2-3分鍾。 我在這里按照說明進行操作: https : //medium.com/exploring-code/how-to-decrease-your-gradle-build-time-by-65-310b572b0c43

我有Firebase Analytics,Performance和Crashlytics的基本實現。 正如您所看到的,對於Google來說,這僅僅是appcompat,約束。 除了unity-ads以外,其余的依賴項看起來都很好(正在使用)。

有任何想法嗎? 謝謝!

應用程序構建表

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'

建檔:

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

buildscript {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
        maven {
            url 'https://maven.fabric.io/public'
        }

        mavenCentral()
        maven(){
            url "https://oss.sonatype.org/content/repositories/snapshots"
            }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.2.0'
        classpath "io.realm:realm-gradle-plugin:5.1.0"
        classpath 'io.fabric.tools:gradle:1.25.1'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        //maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
        mavenCentral()
        maven(){
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
        google()
    }
}

檢查“全局Gradle設置”下的“離線工作”

它將減少90%的gradle構建時間。

嘗試這個。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM