Gradle build fails with Out of Memory: Java heap space error

文章推薦指數: 80 %
投票人數:10人

Give more RAM for gradle org.gradle.jvmargs=-Xmx4g; If you face the same problem after can run for a few times, open Task Manager , End task ... Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore GradlebuildfailswithOutofMemory:Javaheapspaceerror AskQuestion Asked 2yearsago Modified 7monthsago Viewed 17ktimes 9 Iamgettinggradlebuilderrorwhilerunningtheapp.Iamusingwindows10with8GBRAM,Androidstudioversion4.0.1 Outofmemory:Javaheapspace.PleaseassignmorememorytoGradlein theproject'sgradle.propertiesfile.Forexample,thefollowingline, inthegradle.propertiesfile,setsthemaximumJavaheapsizeto 1,024MB:org.gradle.jvmargs=-Xmx1024m EvenafterfollowingthesamestepsIamnotabletoruntheapp.Couldanyonehelpwithapermanentsolutionforthiserror??? Hereismygradle.propertiesfile: android.enableJetifier=true android.useAndroidX=true org.gradle.jvmargs=-Xmx1024m androidandroid-studiogradleout-of-memorygradle.properties Share Improvethisquestion Follow editedDec8,2021at14:25 zb226 8,71166goldbadges4545silverbadges7474bronzebadges askedJul25,2020at12:06 KartikaVijKartikaVij 31322goldbadges33silverbadges1515bronzebadges 3 Canyoutellmewhichosyouusing?(Windows/Mac...)howmanyGBofRAMyouhave?Andshareyourprojectgradle.propertiesplease – ThuanTang Jul25,2020at12:51 Ihaveeditedmyquestion – KartikaVij Jul25,2020at13:00 Takealookatthisstackoverflow.com/questions/39547100/… – sajjad Jul25,2020at13:08 Addacomment  |  4Answers 4 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 7 GivemoreRAMforgradleorg.gradle.jvmargs=-Xmx4g Ifyoufacethesameproblemaftercanrunforafewtimes,openTaskManager,EndtaskanyOpenJDKPlatformbinaryorJava(TM)SeBinarytoreleaseRAM,thenyoucanrunprojectagain. Ifyourcomputerhavelessthan8GBRAM,setlikethisinyourgradle.propertiesorg.gradle.jvmargs=-Xmx2048M Share Improvethisanswer Follow answeredJul25,2020at13:06 ThuanTangThuanTang 12155bronzebadges 0 Addacomment  |  3 Ifacedthesameissueinmy"react":"17.0.2","react-native":"0.66.1"project Gotoproject/android/gradlew.properties &uncommentthisline #org.gradle.jvmargs=-Xmx2048m-XX:MaxPermSize=512m-XX:+HeapDumpOnOutOfMemoryError-Dfile.encoding=UTF-8 andonlychangethecodebeforecolan(:)org.gradle.jvmargs=-Xmx2048m-XX:MaxPermSize=512m-XXtoorg.gradle.jvmargs=-Xmx3g-XX:MaxPermSize=512m-XX thensaveandrunyourbuild Share Improvethisanswer Follow answeredNov23,2021at15:37 abhishabhish 11711silverbadge55bronzebadges Addacomment  |  2 I'mworkingonabigandroidprojectwithmultiplemodulesandflavorsandhadthesameproblem. Itriedeverythingfromtweakingmemorytocleaningproject,restartingwhileinvalidatingcache,deletingsourcesandrecloningfromrepo. Iendedupdeletingthe".gradle"folderinmyuserfolderandrecloningmyproject..anditworked.Lostalotoftimeonthisthough. Share Improvethisanswer Follow answeredSep15,2020at10:15 AlexMokAlexMok 72455silverbadges1818bronzebadges Addacomment  |  -1 Addingandroid:largeHeap="true"totheAndroidManifest.xmlmaysolveyourproblem,ifyouhaven'talreadyadded.Butnotethatthemainissueisyourappisconsumingtoomuchmemory.Considertrackingyourappatruntimetofindtheunusualmemoryconsumingprocess/objects. Share Improvethisanswer Follow answeredJul25,2020at12:31 sajjadsajjad 77644silverbadges1313bronzebadges 4 Ihavealreadyadded,itworkedoncebutwhenItriedtorunagainthensameerror – KartikaVij Jul25,2020at12:33 TherecanbemanypossibilitiesleadingtoOutOfMemoryException.ListViews,toomanylivingFragments,loadinghighqualityimagesetc.Sotrytofigureoutthememorykillerobjectsinyourcode. – sajjad Jul25,2020at12:38 3 Thisforappwhenucanbuild,theerrormessageappearwhenhebuildingtheproject – ThuanTang Jul25,2020at12:50 1 YesIamnotabletorunmyappthenhowwouldIfigureoutanything? – KartikaVij Jul25,2020at12:58 Addacomment  |  YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedandroidandroid-studiogradleout-of-memorygradle.propertiesoraskyourownquestion. TheOverflowBlog Measurableandmeaningfulskilllevelsfordevelopers SanFrancisco?MorelikeSanFrancis-go(Ep.468) FeaturedonMeta AnnouncingtheStacksEditorBetarelease! The[shopping]and[shop]tagsarebeingburninated Linked 26 AndroidStudioBuildgradleOutOfMemoryError Related 523 Howtodealwith"java.lang.OutOfMemoryError:Javaheapspace"error? 1239 Dealingwith"java.lang.OutOfMemoryError:PermGenspace"error 0 Error:Unabletostartthedaemonprocess:couldnotreserveenoughspaceforobjectheap 26 AndroidStudioBuildgradleOutOfMemoryError 0 Androidstudio-Javaheapspace 1 AndroidStudio3.3.1Outofmemory:Javaheapspaceproblem 6 GettingOutofmemory:Javaheapspace.ORGCoverheadlimitexceededwhenbuildingreleaseAPKafterAndroidstudio3.4update 0 AndroidStudio:Outofmemory:Javaheapspace HotNetworkQuestions Isthereawordthatmeans"relax",butwithnegativeconnotations? Wouldaftstabilisers,thatcanmoveupanddown,haveanybenefits? Spacingbeforeandafter\color{} Ifasampleisnormallydistributed,isitspopulationalwaysnormallydistributed? Isthisa"teachers'lounge"? Eggusinggeonodesnotworking WhydoFrenchcustomssearchFlixBuses Geometrynode-Rotatinginstancealongacurvewithanimation Animestylemovieaboutmutatedpeoplethatgainmurderousabilitiessuchasprojectile-shootinglimbsandlimbswithbladesontheends Isthereanameforthisfallacywhensomeonesayssomethingisgoodbyonlypointingoutthegoodthings? Whyaremysaltcuredeggyolksstillwet? Revisedmanuscriptsenttoanewrefereeaftereditorhearingbackfromonereferee:What'sthepossiblereason? Submittingrevisedmanuscriptlongbeforeduedate Howtoavoidstalemateintheposition? Asa(non)residentalienintheUS,whatdocuments(ifany)doesoneneedtocarryatalltimes? DidtheAlgol68standardallowaproceduretobecalledbeforeitsdeclaration? What'sareasonableenvironmentaldisasterthatcouldbecausedbyaprobefromEarthenteringEuropa'socean? IE'sExtraRobustColorParsing® Splittinglinesbymultiplepolygons,takinglengthofparticularsegment,usingPostGIS Willa10mmeyepiecewithabarlow2xproducethesameresultasa5mmeyepiece? HowtoextendusefullifeofIRLEDandphotodiodepair Iscodathesamethingasacadence? WhichbookshouldIchoosetogetintotheLispWorld? Isitnecessarytoprovidecontactinformationfortensofco-authorswhensubmittingapaperfromalargecollaboration? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. default Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?