To run dex in process, the Gradle daemon needs a larger heap. It currently has 910 MB

前端 未结 3 935
误落风尘
误落风尘 2021-02-01 20:48

Actually the main error is \"java.exe finished with non-zero exit value 1\". First i tell you every problem which i faced after installing studio:

Three day

3条回答
  •  忘掉有多难
    2021-02-01 21:51

    Issue

    In gradle plugin version 2.0.0-alpha7 and -alpha8 Dex runs inside gradle build process as opposed to a separate process.

    Option a)

    Change gradle plugin version to 2.0.0-alpha9 where in-process Dex is disabled by default.

    classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
    

    Option b)

    Disable in-process dex in your app module build.gradle:

    android {
        // ...
        dexOptions {
            dexInProcess = false
        }
    }
    

    Option c)

    Increase memory available to gradle process.

    Create or update gradle.properties file in your project root directory:

    # Default value: -Xmx10248m -XX:MaxPermSize=256m
    org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m
    

    And update your app module build.gradle file:

    dexOptions {
        preDexLibraries true
        javaMaxHeapSize "3g"
        incremental true
        dexInProcess = true
    }
    

    These values are experimental and work for my setup. I use 3 GB for dex and 4 GB for gradle (3 + 1 GB).

    Note

    If you have any issues update to alpha9 anyway.

提交回复
热议问题