在Android中缓慢构建gradle

纳迪米先生

我检查了所有问题,并找到了有关缓慢gradle构建的答案。(例如,这里这里和...)。但是在我的项目中构建gradle太慢了。有时哪座建筑大约需要5-8分钟的时间,我在许多网站上搜索过,现在我累了

Build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.2'
    defaultConfig {
        applicationId "..."
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"

        jackOptions {
            enabled true
            additionalParameters('jack.incremental': 'true')
        }


        dexOptions {
            incremental true
            javaMaxHeapSize "4g"
        }
    }


    compileOptions {
        incremental true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }



    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/TelegramNewApiLibrary.jar')
    compile files('libs/TelegramNewConvert.jar')
}
repositories {
    mavenCentral()
}

build.gradle(模块应用):

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'


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

allprojects {
    repositories {
        jcenter()
    }
}

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

gradle.properties:

org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
 org.gradle.parallel=true
 org.gradle.daemon = true

我的防病毒已禁用,并且在项目中启用了脱机工作。

系统内存:4G

系统CPU:3.10 GH

Android Studio版本:2.2.3

有人可以帮助我吗?

丹尼斯·洛伯

尝试将AndroidStudio更新到3.0,升级gradle gradle:2.2.3 => gradle:3.0.0和buildtools buildToolsVersion '25 .0.2'=> buildToolsVersion '26 .0.2'

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章