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

前端 未结 3 845
误落风尘
误落风尘 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:24

    I found the solution.

    Changes 1)

     dexOptions {
                javaMaxHeapSize "4g"
            }
    

    2)

     lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }
    

    This is my new build.gradle and everything is working fine now.

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "24.0.0 rc4"
    
        dexOptions {
            javaMaxHeapSize "4g"
        }
        defaultConfig {
            applicationId "com.aquasoft.guesp"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.mcxiaoke.volley:library-aar:1.0.0'
        compile 'com.android.support:recyclerview-v7:23.3.0'
        compile 'com.squareup.picasso:picasso:2.5.0'
        compile 'com.google.android.gms:play-services:9.0.0'
        compile 'com.android.support:design:23.4.0'
        compile 'com.stripe:stripe-android:+'
        compile 'com.roomorama:caldroid:3.0.1'
        compile 'com.android.support:cardview-v7:23.3.+'
    }
    
    0 讨论(0)
  • 2021-02-01 21:26

    try this gradle params

    defaultConfig {
        ...
    
        // Enabling multidex support.
        multiDexEnabled true
    }
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题