I want to update my app, but when I try to generate a signed apk, I receive an error with these messages:

I want to update my app, but when I try to generate a signed apk, I receive an error with these messages:

Problem in your maximum memory allocation pool for a Java Virtual Machine.
You need to modify your gradle.properties file and increase the amount of memory allocated to the Gradle Daemon VM by 2 Gb, to a minimum of 4 Gb, using the org.gradle.jvmargs property: Kindly try as follows
org.gradle.jvmargs=-Xmx4096m
For more information please refer following link https://medium.com/google-developers/faster-android-studio-builds-with-dex-in-process-5988ed8aa37e