Ready Android
Ready Android

Reputation: 3622

Error:Execution failed for task ':app:packageDebug' - Java heap space

I am getting this error in Android Studio logs when I am trying to build an APK.

Error:Execution failed for task ':app:packageDebug'. Java heap space

This issue is coming when I am trying to build an APK with 350 MB size of .sqlite in assets directory. When I removed the .sqlite file then issue is gone.

My studio64.exe.vmoptions file for studio:

-Xms2048m
-Xmx3840m
-XX:ReservedCodeCacheSize=960m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=250
-da
-Djna.nosys=true
-Djna.boot.library.path=

-Djna.debug_load=true
-Djna.debug_load.jna=true
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Didea.paths.selector=AndroidStudio2.3
-Didea.platform.prefix=AndroidStudio
-Didea.jre.check=true

enter image description here

Upvotes: 10

Views: 20438

Answers (2)

Rahul Shakya
Rahul Shakya

Reputation: 1425

clean the project and try again

On root folder

cd android

./gradlew clean

cd ..

react-native run-android

Upvotes: 0

fluffyBatman
fluffyBatman

Reputation: 6704

Add this at the end of gradle.properties file.

org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m

Upvotes: 29

Related Questions