建议使用更大的Gradle守护程序堆来运行jack [英] A larger heap for the Gradle daemon is recommended for running jack

查看:140
本文介绍了建议使用更大的Gradle守护程序堆来运行jack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手.我目前正在尝试在gradle设置中将研究型Android应用程序升级到Java 1.8,在该应用程序中,它提示我启用jackOptions为'true',以便可以在应用程序中使用lambda表达式.

Im pretty new to gradle. I currently tried to upgrade a study Android app to Java 1.8 in gradle settings in which it prompted me to enable jackOptions to 'true' so i could use lambda expressions in my app.

这是我当前的gradle选项:

This is my current gradle options:

build.gradle

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    dexOptions{
        javaMaxHeapSize "4g"
    }

    defaultConfig {
        applicationId "com.bmw.www.team10"
        minSdkVersion 23
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

        jackOptions{
            enabled true
        }
    }

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

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.android.gms:play-services-ads:9.6.1'
    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.google.android.gms:play-services:9.6.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
    compile 'com.android.support:cardview-v7:24.2.1'
}

gradle.properties

gradle.properties

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx2048m -XX:MaxPermSize=2048m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

当我尝试构建项目时,这会在gradle控制台中循环10分钟

When i try to build my project, this loops for 10 minutes in the gradle console

A larger heap for the Gradle daemon is recommended for running jack.

It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

推荐答案

在gradle.properties中取消注释此行:

uncomment this line in gradle.properties :

# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

这篇关于建议使用更大的Gradle守护程序堆来运行jack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆