App works on Sim but doesn't work on device

Hi Experts,

I have built a project for android using storyboard. Everything works as expected on the simulator but on actual devices ( tried many) I am facing many issues, possibly because of storyboard.
 

  1. Below is the pseudo code of what I am doing. The objects initiated in createScene are not getting displayed on device properly ( some of the objects are displayed, some of them are not…some of the sprite animation is working, some are not…some of the (transition.to)'s are working, some are not…etc…looks like only first couple of objects are getting initiated )

  2. event listeners are not getting added to the objects on device but works good on sim.

  

PS–> Please note that i have tried multiple android devices ( and also bluestock) but the issues are same everywhere except on corona simulator where the game works awesome !

Am i missing anything here ? What i am doing wrong ? any suggestions/tips/help appreciated !   is there any thing I need to do at config file ? 

 [lua]local physics = require( “physics” )

local json = require(“json”)
local storyboard = require (“storyboard”)
local widget = require (“widget”)
local playfile = require (“play”)
local ani = require “sprite”

local scene = storyboard.newScene()

physics.start()
physics.setGravity( 0,1 )

— Declaring shapes from Gumbo --------------------------------------------------------------------
local shape_1 = { -237,-94, -228,-110, -178,-134, -124,-138, -99,-129, -99,-129, -122,-99, -151,-96 }
shape_1.density = 1; shape_1.friction = 0.3; shape_1.bounce = 0.2;

– above is just an example, I am defining multiple other shapes here–

– Declaring objects ---------------------------------------------------------------------------------
local object1 = display.newImageRect( “object.png”,10,10 )
local object2 = display.newImageRect( “object.png”,10,10 )
local object3 = display.newImageRect( “object.png”,10,10 )
local powerup1 = display.newImageRect( “powerup.png”,10,10 )
local powerup2 = display.newImageRect( “powerup.png”,10,10 )
local powerup3 = display.newImageRect( “powerup.png”,10,10 )

----just example, I am declaring around 30-40 objects here—

function scene:createScene(event)

local screenGroup = self.view

–Initializing sprites, assigning properties to above declared objects ( color, alpha, coordinates etc)

end
 


–Here, writing all local functions which are part of game logic

—given functions are example, i am defining around 15-20 more functions…have not mentioned those for the sake of clarity of reader


local function GameOver()
storyboard.gotoScene(“play”, “fade”, 1500)
end

local function monitorScore(event)
score.text = "Score: " … k
end

local function rotateobject()
object1.rotation = object1.rotation + 1
object2.rotation = object2.rotation + 1
object3.rotation = object3.rotation + 1
end

local function Restart()
–Code to restart game
end

local function Pause()
–Code to pause game
end

local function Resume()
–Code to resume game
end

function scene:enterScene(event)

PauseButton:addEventListener(“touch”, pause) 
ResumeButton:addEventListener(“touch”, resume) 
RestartButton:addEventListener(“touch”, resume)
Runtime:addEventListener(“enterFrame”, rotateobject)
Runtime:addEventListener(“enterFrame”, monitorScore)

end

function scene:exitScene(event)

PauseButton:removeEventListener(“touch”, pause) – just as example
ResumeButton:removeEventListener(“touch”, resume) — just as example
RestartButton:removeEventListener(“touch”, resume) — just as example
Runtime:removeEventListener(“enterFrame”, rotateobject)
Runtime:removeEventListener(“enterFrame”, monitorScore)
end

function scene:destroyScene(event)

—nothing here
end

function scene:didExitScene( event )
storyboard.removeScene( storyboard.getPrevious())
end

scene:addEventListener( “didExitScene” )
scene:addEventListener(“createScene”, scene)
scene:addEventListener(“enterScene”, scene)
scene:addEventListener(“exitScene”, scene)
scene:addEventListener(“destroyScene”, scene)

 

return scene[/lua] 

Hi @vibhubhola89,

There are too many possibilities for us (or the community) to help you determine where the issue is. Please follow through the following tutorial on basic debugging, and report back with a more specific description of what is occurring.

http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks,

Brent Sorrentino

Thanks Brent,

We have already done debugging in Simulator where the app works like a magic and we see no issues. Problem comes when we run on device. Any suggestions on in-device debugging ?

Hi Vibhu,

             I have no experience working with storyboard but I’ve had similar issues in the past and 9 times out of 10 its down to the image file names! In the simulator they are not case specific so you can have your images named OBJECT.png then when you draw them to the screen you can refer to them as obJEct.png / object.png ect ect and it will still work in the simulator however on the actual Android device they ARE case specific, so if your image file is called object.png and you tried to refer to it using Object.png it fails to draw but the rest of the code will still run giving the sort of symptoms you have described.

I’d go through all your image files and references to them in your code to make sure they are all in the same case format.

Kind Regards,

Also, Vibhu, the blog post that Brent pointed to does talk about on-device debugging.  Since you’re using Android, scroll down to the section in the blog post for Android Devices, where it has instructions how to see the log (and any error messages) when running on a device.

  • Andrew

Thanks a lot everyone. It is resolved now. As Krivvenz suggested, there was problem with image reference in our code. I was mentioning “nebula.png” in lua file for an image with name “Nebula.png” 

Thanks again.

Cheers!

Hi @vibhubhola89,

There are too many possibilities for us (or the community) to help you determine where the issue is. Please follow through the following tutorial on basic debugging, and report back with a more specific description of what is occurring.

http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks,

Brent Sorrentino

Thanks Brent,

We have already done debugging in Simulator where the app works like a magic and we see no issues. Problem comes when we run on device. Any suggestions on in-device debugging ?

Hi Vibhu,

             I have no experience working with storyboard but I’ve had similar issues in the past and 9 times out of 10 its down to the image file names! In the simulator they are not case specific so you can have your images named OBJECT.png then when you draw them to the screen you can refer to them as obJEct.png / object.png ect ect and it will still work in the simulator however on the actual Android device they ARE case specific, so if your image file is called object.png and you tried to refer to it using Object.png it fails to draw but the rest of the code will still run giving the sort of symptoms you have described.

I’d go through all your image files and references to them in your code to make sure they are all in the same case format.

Kind Regards,

Also, Vibhu, the blog post that Brent pointed to does talk about on-device debugging.  Since you’re using Android, scroll down to the section in the blog post for Android Devices, where it has instructions how to see the log (and any error messages) when running on a device.

  • Andrew

Thanks a lot everyone. It is resolved now. As Krivvenz suggested, there was problem with image reference in our code. I was mentioning “nebula.png” in lua file for an image with name “Nebula.png” 

Thanks again.

Cheers!