Question: I am getting gradle build error while running the app. I am using windows 10 with 8GB RAM, Android studio version 4.0.1

> 
> Out of memory: Java heap space. Please assign more memory to Gradle in
> the project's gradle.properties file. For example, the following line,
> in the gradle.properties file, sets the maximum Java heap size to
> 1,024 MB: *org.gradle.jvmargs=-Xmx1024m*
> 
> 
> 

Even after following the same steps I am not able to run the app. Could anyone help with a permanent solution for this error???

Here is my gradle.properties file:

```
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1024m

```

Answer: 
I'm working on a big android project with multiple modules and flavors and had the same problem.

I tried everything from tweaking memory to cleaning project, restarting while invalidating cache, deleting sources and recloning from repo.

I ended up deleting the ".gradle" folder in my user folder and recloning my project.. and it worked. Lost a lot of time on this though.
Adding `android:largeHeap="true"` to the `AndroidManifest.xml` may solve your problem, if you haven't already added. But note that the main issue is your app is consuming too much memory. Consider tracking your app at runtime to find the unusual memory consuming process/objects.

```
<manifest 
     ...
     <application 
         android:largeHeap="true"
         ...

     </application>
</manifest>

```