[RESOLVED] Built app to test on device, but trouble

I’m not entirely sure which forum to post this in because I’m not entirely sure what the issue is. I could be storyboard but I don’t know…

I wanted to test my app out on my nexus 7 so I built it, and moved it onto the device and ran it.
All of that went fine.
I run the app and it starts up just fine, I get my menu screen with an option for new game.
the new game option screen comes up and I can set my options just fine.
I click on my launch button, which is not a button, but a a newRoundedRect with a touch event listener

-- Launch Button  
 launch = display.newRoundedRect( 0, 0, 100, 32, 7 )  
 launch:setReferencePoint(display.TopLeftReferencePoint)  
 launch.isVisible = true  
 launch.x = 380  
 launch.y = 285  
 launch.id = "Launch"  
  
 -- TouchListener  
 launch:addEventListener("touch", onLaunchTouch)  
  
 -- Insert into grid array  
 mainDisplay:insert(launch)  
  
 -- Fill tile with correct color  
 launch:setFillColor( 157, 173, 249 )  
  
 -- Paint a stoke line  
 launch:setStrokeColor(140, 140, 140)  
 launch.strokeWidth = 3  
  
 -- style text  
 launch.Text = display.newText( "LAUNCH", 0, 0, native.systemFontBold, 22 )  
 launch.Text:setReferencePoint(display.CenterReferencePoint)  
 gamestyle.normal.Text:setTextColor( 255, 255, 255 )  
 mainDisplay:insert(launch.Text)  
 launch.Text.x = launch.x + 50  
 launch.Text.y = launch.y + 16  
 launch.Text:toFront()  

the touch event functions is as follows.
I’m sorry that I’m posting it unabridged but my issue may be in there somewhere and since I’m still in over my head…

-- function to handle Launch Touch  
 local onLaunchTouch = function ( event )  
 if event.phase == "began" then  
 print( "You pressed the Launch Button" )  
 launch:setStrokeColor( 0, 0, 0 )  
 -- Load Game Settings Data into an Array   
 local gameTable = {}  
 gameTable = loadsave.loadTable("defaultgame.json")  
  
 -- If there's a problem   
 if gameTable == nil then  
 print( "\nFailed to load gameTable" )  
 else  
 print( "\nLoaded gameTable")  
 end   
  
 -- Load map data   
 local mapTable = {}  
 mapTable = loadsave.loadTable("defaultmap.json")  
  
 -- If there's a problem   
 if mapTable == nil then  
 print( "\nFailed to load mapTable" )  
 else  
 print( "\nLoaded mapTable")  
 end  
  
 -- Load empire data   
 local empireTable = {}  
 empireTable = loadsave.loadTable("defaultempire.json")  
  
 -- If there's a problem   
 if empireTable == nil then  
 print( "\nFailed to load empireTable" )  
 else  
 print( "\nLoaded empireTable")  
 end  
  
 -- Load leader data   
 local leaderTable = {}  
 leaderTable = loadsave.loadTable("defaultleader.json")  
  
 -- If there's a problem   
 if leaderTable == nil then  
 print( "\nFailed to load leaderTable" )  
 else  
 print( "\nLoaded leaderTable")  
 end  
  
 -- Assign selected data to gameTable  
 gameTable[2] = playerCount  
 gameTable[11] = 1  
 gameTable[12] = 0  
 gameTable[13] = length  
 gameTable[14] = gameType  
  
 if style == "Normal" then  
 for i = 1, playerCount do  
 empireTable[i][1] = 1500  
 empireTable[i][2] = 500  
 empireTable[i][3] = 1000  
 empireTable[i][4] = 1000  
 empireTable[i][5] = 250  
 empireTable[i][6] = 3  
 end  
 elseif style == "DeathMatch" then  
 for i = 1, playerCount do  
 empireTable[i][1] = 15000  
 empireTable[i][2] = 5000  
 empireTable[i][3] = 10000  
 empireTable[i][4] = 10000  
 empireTable[i][5] = 2500  
 empireTable[i][6] = 3  
 end  
 end  
  
 -- Assign map file to game bases on player choice  
  
 -- Save the change  
 loadsave.saveTable(gameTable, "newGameGame.json")  
 loadsave.saveTable(mapTable, "newGameMap.json")  
 loadsave.saveTable(empireTable, "newGameEmpire.json")  
 loadsave.saveTable(leaderTable, "newGameLeader.json")  
  
 -- Clean up the mess  
 mainDisplay = nil  
 typeDisplay = nil  
 playerDisplay = nil  
 mapDisplay = nil  
 styleDisplay = nil  
 timerDisplay = nil  
 loginDisplay = nil  
  
 -- If online then go to game lobby  
  
 -- else go to hotseat play and launch the game  
 storyboard.gotoScene( "overlord", "crossFade", 300 )  
  
 end  
 return true   
 end   

What happens on the device is that it does indeed change the stoke color of “launch” but it doesn’t do anything else. It just sits there.

I installed it onto my phone to see if it would work there, but the behavior is exactly the same. My phone is a Motorola Atrix 2, running ICS

I guess I have a question about the json files I use. For the simulator, I have them located in the documents folder of the sandbox for the project. Did these files get included in the build, or where they suppose to be moved to the location where my main.lua file is located?

It probably isn’t a storyboard issue since I transition from main.lua to newGame.lua with storyboard and that part works… :frowning: [import]uid: 170004 topic_id: 35796 reply_id: 335796[/import]

Files you put in the DocumentsDirectory do not get included in the bundle. They need to be in your folder with your main.lua and then you can reference them from system.ResourceDirectory. And if you need to be able to updated, them, then on first start, you would save them out to system.DocumentsDirectory.

[import]uid: 199310 topic_id: 35796 reply_id: 142393[/import]

I’d install aLogCat on your android devices and filter through the error log to check the real problem on your devices. It might get your a bit more information as to the errors getting thrown on your Atrix. [import]uid: 135394 topic_id: 35796 reply_id: 142395[/import]

that makes sense.
I already copied them over to the same folder with my main.lua file.
Not quite sure how to reference them correctly but I’ll keep digging for that info.
I use the original 4 json files to create a new set of files each time a new game is created, so during that process, it sounds like I just need to save them to the system.DocumentsDirectory and from there I can access them if I reference them correctly.

If I make these changes, then, will it all stop working in the simulator?

I’m actually using a json file load and save module that you posted a while back Rob, so I assume the referencing changes need to happen in that module…

an example of how to reference those files would be great.

ty
[import]uid: 170004 topic_id: 35796 reply_id: 142397[/import]

update
I was able to make the changes necessarily to get it start working.
I am finding issues still that worked on the simulator but are not working on the devices, I’m sure I’ll get them sorted.

I was rather hoping that the issue I’m having with scrollview:scrollToBottom() would work, but that function is still not working at all, which means I am going to have to file a bug a report for it, and waste and hour or more putting together a stripped down example, sigh…

Thanks for your help Rob [import]uid: 170004 topic_id: 35796 reply_id: 142404[/import]

system.ResourceDirectory would be how to access the files in the folder with main.lua. The save/load table functions should work with the resource folder.

As far as the scrollView bug, we are readying new widgets and scrollView is getting a makeover. This is already a known bug, and the fix should be in the new version. I’ve asked to verify. I’d hold off on the bug report for now. [import]uid: 199310 topic_id: 35796 reply_id: 142438[/import]

okay, thanks Rob [import]uid: 170004 topic_id: 35796 reply_id: 142441[/import]

Files you put in the DocumentsDirectory do not get included in the bundle. They need to be in your folder with your main.lua and then you can reference them from system.ResourceDirectory. And if you need to be able to updated, them, then on first start, you would save them out to system.DocumentsDirectory.

[import]uid: 199310 topic_id: 35796 reply_id: 142393[/import]

I’d install aLogCat on your android devices and filter through the error log to check the real problem on your devices. It might get your a bit more information as to the errors getting thrown on your Atrix. [import]uid: 135394 topic_id: 35796 reply_id: 142395[/import]

that makes sense.
I already copied them over to the same folder with my main.lua file.
Not quite sure how to reference them correctly but I’ll keep digging for that info.
I use the original 4 json files to create a new set of files each time a new game is created, so during that process, it sounds like I just need to save them to the system.DocumentsDirectory and from there I can access them if I reference them correctly.

If I make these changes, then, will it all stop working in the simulator?

I’m actually using a json file load and save module that you posted a while back Rob, so I assume the referencing changes need to happen in that module…

an example of how to reference those files would be great.

ty
[import]uid: 170004 topic_id: 35796 reply_id: 142397[/import]

update
I was able to make the changes necessarily to get it start working.
I am finding issues still that worked on the simulator but are not working on the devices, I’m sure I’ll get them sorted.

I was rather hoping that the issue I’m having with scrollview:scrollToBottom() would work, but that function is still not working at all, which means I am going to have to file a bug a report for it, and waste and hour or more putting together a stripped down example, sigh…

Thanks for your help Rob [import]uid: 170004 topic_id: 35796 reply_id: 142404[/import]

system.ResourceDirectory would be how to access the files in the folder with main.lua. The save/load table functions should work with the resource folder.

As far as the scrollView bug, we are readying new widgets and scrollView is getting a makeover. This is already a known bug, and the fix should be in the new version. I’ve asked to verify. I’d hold off on the bug report for now. [import]uid: 199310 topic_id: 35796 reply_id: 142438[/import]

okay, thanks Rob [import]uid: 170004 topic_id: 35796 reply_id: 142441[/import]