Issues with apk crashing on device

Hello,

I have put together a simple comic app using the slideview code in Corona, signed it, etc. It is live as a free download, Penguin Bros, but it crashes on both devices I have tried. A Droid2 and LG Ally2 Touch. Are there known issues that I need to fix do a proper build? What .Lua code needs to be posted for review? Anything would help!!

Thanks,
j [import]uid: 26686 topic_id: 6301 reply_id: 306301[/import]

Think you need to provide some detail :slight_smile: What devices has it worked on? How is your code generally structured? Also why would you put it on the market if it doesn’t work? I just tried to download it but it couldn’t be found on the market. [import]uid: 23949 topic_id: 6301 reply_id: 21784[/import]

Well, I am technically employed as a graphics guy, I am not developing by choice but can appreciate what I am learning. That being said, it was a test to see whether or not I had the keytool/keystore figured out. Still really struggling with that one. I was told to remove the app to fix so that is why you could not find it.

The only 2 test devices that it has been tried on are the Droid and Ally.

As far as code, I just placed the images in the existing sample code, no changes other than that.

Unfortunately, I am in the middle of trying to figure this out as I go with no experience so that is where the brick wall comes in. Below is the code that I have. Do I need to add more, what do I need to tweak? My list of questions is long, so I won’t put ya sleep. :slight_smile: But thanks for ANYthing that will help at this point. Very much appreciated!!

– config.lua

application =
{
content =
{
width = 320,
height = 480,
scale = “zoomeven”
},
}
display.setStatusBar( display.HiddenStatusBar )

local slideView = require(“slideView”)

local myImages = {
“myPhotos0.jpg”,
“myPhotos1.jpg”,
“myPhotos2.jpg”,
“myPhotos3.jpg”,
“myPhotos4.jpg”,
“myPhotos5.jpg”,
“myPhotos6.jpg”,
“myPhotos7.jpg”,
“myPhotos8.jpg”,
“myPhotos9.jpg”,
“myPhotos10.jpg”,
“myPhotos11.jpg”,
“myPhotos12.jpg”,
“myPhotos13.jpg”,
“myPhotos14.jpg”,
“myPhotos15.jpg”,
“myPhotos16.jpg”,
“myPhotos17.jpg”,
“myPhotos18.jpg”,
“myPhotos19.jpg”,
“myPhotos20.jpg”,
“myPhotos21.jpg”,
“myPhotos22.jpg”,
“myPhotos23.jpg”,
“myPhotos24.jpg”,
“myPhotos25.jpg”,
“myPhotos26.jpg”,
“myPhotos27.jpg”
}

slideView.new( myImages )

–[[

– Examples of other parameters:

– Show a background image behind the slides
slideView.new( myImages, “bg.jpg” )

– Insert space at the top and bottom
slideView.new( myImages, nil, 40, 60 )

–]]
module(…, package.seeall)

local screenW, screenH = display.contentWidth, display.contentHeight
local viewableScreenW, viewableScreenH = display.viewableContentWidth, display.viewableContentHeight
local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight

local imgNum = nil
local images = nil
local touchListener, nextImage, prevImage, cancelMove, initImage
local background
local imageNumberText, imageNumberTextShadow

function new( imageSet, slideBackground, top, bottom )
local pad = 20
local top = top or 0
local bottom = bottom or 0

local g = display.newGroup()

if slideBackground then
background = display.newImage(slideBackground, 0, 0, true)
else
background = display.newRect( 0, 0, screenW, screenH-(top+bottom) )
background:setFillColor(0, 0, 0)
end
g:insert(background)

images = {}
for i = 1,#imageSet do
local p = display.newImage(imageSet[i])
local h = viewableScreenH-(top+bottom)
if p.width > viewableScreenW or p.height > h then
if p.width/viewableScreenW > p.height/h then
p.xScale = viewableScreenW/p.width
p.yScale = viewableScreenW/p.width
else
p.xScale = h/p.height
p.yScale = h/p.height
end
end
g:insert§

if (i > 1) then
p.x = screenW*1.5 + pad – all images offscreen except the first one
else
p.x = screenW*.5
end

p.y = h*.5

images[i] = p
end

local defaultString = "1 of " … #images

local navBar = display.newGroup()
g:insert(navBar)

local navBarGraphic = display.newImage(“navBar.png”, 0, 0, false)
navBar:insert(navBarGraphic)
navBarGraphic.x = viewableScreenW*.5
navBarGraphic.y = 0

imageNumberText = display.newText(defaultString, 0, 0, native.systemFontBold, 14)
imageNumberText:setTextColor(255, 255, 255)
imageNumberTextShadow = display.newText(defaultString, 0, 0, native.systemFontBold, 14)
imageNumberTextShadow:setTextColor(0, 0, 0)
navBar:insert(imageNumberTextShadow)
navBar:insert(imageNumberText)
imageNumberText.x = navBar.width*.5
imageNumberText.y = navBarGraphic.y
imageNumberTextShadow.x = imageNumberText.x - 1
imageNumberTextShadow.y = imageNumberText.y - 1

navBar.y = math.floor(navBar.height*0.5)

imgNum = 1

g.x = 0
g.y = top + display.screenOriginY

function touchListener (self, touch)
local phase = touch.phase
print(“slides”, phase)
if ( phase == “began” ) then
– Subsequent touch events will target button even if they are outside the contentBounds of button
display.getCurrentStage():setFocus( self )
self.isFocus = true

startPos = touch.x
prevPos = touch.x

transition.to( navBar, { time=200, alpha=math.abs(navBar.alpha-1) } )

elseif( self.isFocus ) then

if ( phase == “moved” ) then

transition.to(navBar, { time=400, alpha=0 } )

if tween then transition.cancel(tween) end

print(imgNum)

local delta = touch.x - prevPos
prevPos = touch.x

images[imgNum].x = images[imgNum].x + delta

if (images[imgNum-1]) then
images[imgNum-1].x = images[imgNum-1].x + delta
end

if (images[imgNum+1]) then
images[imgNum+1].x = images[imgNum+1].x + delta
end

elseif ( phase == “ended” or phase == “cancelled” ) then

dragDistance = touch.x - startPos
print("dragDistance: " … dragDistance)

if (dragDistance < -40 and imgNum < #images) then
nextImage()
elseif (dragDistance > 40 and imgNum > 1) then
prevImage()
else
cancelMove()
end

if ( phase == “cancelled” ) then
cancelMove()
end

– Allow touch events to be sent normally to the objects they “hit”
display.getCurrentStage():setFocus( nil )
self.isFocus = false

end
end

return true

end

function setSlideNumber()
print(“setSlideNumber”, imgNum … " of " … #images)
imageNumberText.text = imgNum … " of " … #images
imageNumberTextShadow.text = imgNum … " of " … #images
end

function cancelTween()
if prevTween then
transition.cancel(prevTween)
end
prevTween = tween
end

function nextImage()
tween = transition.to( images[imgNum], {time=400, x=(screenW*.5 + pad)*-1, transition=easing.outExpo } )
tween = transition.to( images[imgNum+1], {time=400, x=screenW*.5, transition=easing.outExpo } )
imgNum = imgNum + 1
initImage(imgNum)
end

function prevImage()
tween = transition.to( images[imgNum], {time=400, x=screenW*1.5+pad, transition=easing.outExpo } )
tween = transition.to( images[imgNum-1], {time=400, x=screenW*.5, transition=easing.outExpo } )
imgNum = imgNum - 1
initImage(imgNum)
end

function cancelMove()
tween = transition.to( images[imgNum], {time=400, x=screenW*.5, transition=easing.outExpo } )
tween = transition.to( images[imgNum-1], {time=400, x=(screenW*.5 + pad)*-1, transition=easing.outExpo } )
tween = transition.to( images[imgNum+1], {time=400, x=screenW*1.5+pad, transition=easing.outExpo } )
end

function initImage(num)
if (num < #images) then
images[num+1].x = screenW*1.5 + pad
end
if (num > 1) then
images[num-1].x = (screenW*.5 + pad)*-1
end
setSlideNumber()
end

background.touch = touchListener
background:addEventListener( “touch”, background )


– Define public methods

function g:jumpToImage(num)
local i
print(“jumpToImage”)
print("#images", #images)
for i = 1, #images do
if i < num then
images[i].x = -screenW*.5;
elseif i > num then
images[i].x = screenW*1.5 + pad
else
images[i].x = screenW*.5 - pad
end
end
imgNum = num
initImage(imgNum)
end

function g:cleanUp()
print(“slides cleanUp”)
background:removeEventListener(“touch”, touchListener)
end

return g
end

[import]uid: 26686 topic_id: 6301 reply_id: 21796[/import]

Hi, can you re-post with <1ua>1ua> tags surrounding the code (use lua in place of 1ua)? Thanks :slight_smile:
PS I’m at work and might not be able to help much I’m afraid, but I’ll take a quick look. [import]uid: 23949 topic_id: 6301 reply_id: 21819[/import]

PS: try convert to PNG and try it. Aren’t there some issues with Corona on Android handling JPGs? Could be wrong.

Edit: also, which sample code did you base it on (please provide a link) [import]uid: 23949 topic_id: 6301 reply_id: 21820[/import]