Android Build error: Could not reserve enough space

You can run regEdit and find the keys for “ant” and check/set the value of:  “debugBuildProcess”  to “2”. This will cut back the amount of logging that ant does when it builds. We suspect your debugging has been bumped up.

Rob

Hi Rob.

I did not find the key “ant” in the registry.

Also did not find the key “debugBuildProcess”.

I found the key “HKEY_CURRENT_USER \ SOFTWARE \ Ansca Corona” and I created “debugBuildProcess” with value “2”, but the error has continued.

The engineers can’t reproduce this. Can you do two things?

  1. Let me know if you have the issue building our any of our sample apps?

  2. Can you post your build.settings?  Make sure to use the <> button in the edit bar in the Forum post editor to paste your code in.

Thanks

Rob

Hi Rob.

I can build sample apps.

I can build my app, but only after removing the sprites. If I add the sprites, the error happens again.

My build.settings file:

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "landscapeRight", supported = { "landscapeRight", "landscapeLeft" } }, iphone = { plist = { CFBundleDisplayName = "Puppy Patrol", CFBundleName = "Puppy Patrol", UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay UILaunchImages = {}, --required MinimumOSVersion = "6.0", --icon image files table CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } }, --[[-- Android permissions androidPermissions = { "android.permission.INTERNET", },]]-- plugins = { -- key is the name passed to Lua's 'require()' ["plugin.google.play.services"] = { -- required publisherId = "com.coronalabs", }, }, }

Thanks for your help!

Can you tell me more about your spites?

What are the pixel dimensions of the images?

Can you post the code you are removing?

Rob

OK.

The dimensions of the images are approximately 2048x2048.

These images contain the sequence of animated images where each frame has approximately 272 x 584.

I have 7 sprites like this in my menu.lua scene:

local animDog2 local sheetOptDog2Idle = require("images.sprites.Dog2\_Idle") local sheetOptDog2Touch = require("images.sprites.Dog2\_Touch") ... local sheet\_dog2 = graphics.newImageSheet( "images/sprites/Dog2\_Idle.png", sheetOptDog2Idle) local sheet\_dog2Touch = graphics.newImageSheet( "images/sprites/Dog2\_Touch.png", sheetOptDog2Touch ) local sequenceDataDog2 = { { name="idle", sheet=sheet\_dog2, start=1, count=19, time=5000, loopCount=0 }, { name="touch", sheet=sheet\_dog2Touch, start=1, count=31, time=2000, loopCount=0 } } animDog2 = display.newSprite( sheet\_dog2, sequenceDataDog2 ) animDog2.x = display.contentWidth\*0.22 animDog2.y = display.contentHeight \* 0.48 animDog2:scale(s,s) animDog2:play() ... group:insert( animDog2 ) animDog2:addEventListener( "touch", onDog2Touch ) function onDog2Touch( event ) if ( event.phase == "began" ) then event.target:setSequence( "touch" ) event.target:play() elseif ( event.phase == "ended" ) then timer.performWithDelay(1900, function() event.target:setSequence( "idle" ) event.target:play() end, 1) end return true end

I created the _JAVA_OPTIONS environment variable, with -Xmx4g value.

With that I managed to open the Android Build Setup window, however, the system is not recognizing the password of my KeyStore.

When I delete the environment variable and build another app, the password is usually recognized.

Why are you setting that variable? Corona SDK should not require you to do anything other than hit the build dialog and fill out those fields.

Rob

I researched and found that the error “Could not reserve enough space…” is related to a problem of memory allocation by Java.

And one of the solutions is to set the environment variable to increase the maximum amount of memory that Java can allocate.

If I delete this environment variable the displayed error is:

Error occurred during initialization of VM

Could not reserve enough space for 262144KB object heap

Debugging session completed (traced 0 instructions).

Program completed in 12.77 seconds (pid: 10524).

If that’s the case, try putting:

largeheap=true;

in your android table in build.settings.

Rob

I added, but the problem continues.

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "landscapeRight", supported = { "landscapeRight", "landscapeLeft" } }, android = { largeHeap = true }, iphone = { plist = { CFBundleDisplayName = "Puppy Patrol", CFBundleName = "Puppy Patrol", UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay UILaunchImages = {}, --required MinimumOSVersion = "6.0", --icon image files table CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } }, --[[-- Android permissions androidPermissions = { "android.permission.INTERNET", },]]-- plugins = { -- key is the name passed to Lua's 'require()' ["plugin.google.play.services"] = { -- required publisherId = "com.coronalabs", }, }, }

How much free memory do you have on your computer? How much free disk space?

Did you try setting the some of the recommended environment variables to control the amount of memory it’s allocating?

Rob

I have 6,8GB of free memory and 90GB available on the disk.

I’ve tried several values for the environment variable. When I configured to 4GB ("-Xmx4g"), the window to Build opened, but does not accept the password for my keystore file.

Are you using your own keystore or a debug keystore?

I’m using my own keystore.