To Run Dex in Process, The Gradle Daemon Needs a Larger Heap. It Currently Has Approximately 910 Mb

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

Set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties. For more information see https://docs.gradle.org/current/userguide/build_environment.html

You can also add this line in your build.gradle

android {
dexOptions {
javaMaxHeapSize "4g"
}
}

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

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.+'
}

jvmargs=-xmx2048m dex in process for cordova

Qiong

You nee to put a file named build-extras.gradlein your platforms/android folder. Cordova will read the file automatically and will load the configuration for you.

You can do this manually or by a hook. The problem of the first option is that if you erase your platform folder, the will be erased as well.

The content of the file specifies the maximum heap size:

android {
dexOptions {
javaMaxHeapSize "2048m"
}
}

If you want to go with the hook option, the content of the should be like this:

#!/usr/bin/env node
'use strict';
var fs = require('fs');
var rootdir = process.argv[2];
if(fs.existsSync(rootdir + '/platforms/android')){
console.log('Add build-extras.gradle');
fs.createReadStream(rootdir + '/build-extras.gradle').pipe(fs.createWriteStream(rootdir + '/platforms/android/build-extras.gradle'));
}

And you need to put the file on hooks/after_prepare/ folder. This will run your hook automatically.



Related Topics



Leave a reply



Submit