bad argument #2 to 'newImageSheet' only on some devices

Hey there, 

One of our users recently emailed us about a crash he was having on his Kindle. The error message that popped up is “bad argument #2 to ‘newImageSheet’ (for single frame size, ‘options’ table must contain valid ‘width’ and ‘height’ values)”

The problem is I was unable to reproduce this on any of my devices so I was wondering if I could get any expert opinions as to what could be going wrong. The code that causes the crash is this: 

local sheetData = { width=168, height=156, -- 156 numFrames=18 } local scene7Sheet = graphics.newImageSheet("scene7\_sparks1\_\_sheet.png", sheetData) -- This line crashes local scene7SequenceData = {{name="normal",start=1,count=18,loopCount=1,time=850}}

I can’t seem to understand why it’s crashing. I looked into using sheetContentWidth/sheetContentHeight in the docs, but don’t think that’s relevant since I handle scaling the animation after it’s been loaded. 

Anyone encounter this issue? The user was using a Kindle Fire HD7, and he’s the only one that had this issue

You are likely running into a texture size limit. On some older android devices, the max texture size is 1024x1024, then another set of Android devices have a limit at 2048x2048.  I don’t know how your sheet is laid out, but if it’s a single row, 168x18 is 3024px. If it’s vertical 156x18 = 2808. So both dimensions are over 2048. Make sure none of the dimensions of your image sheet doesn’t exceed 2048.

Rob

Hey Rob, thanks for your reply! My texture sheet is indeed a single row, so it probably did exceeded the max texture limit on lower end devices. I’ll give it a shot by using multiple rows instead.