Discussion Forums  >  Crashes, Memory Warnings

Replies: 8    Views: 227

recoore
I hate code!
Profile
Posts: 73
Reg: Mar 01, 2013
Kingston
4,880
06/03/13 03:51 PM (10 years ago)

Crash after a few click around on the app

My app shows up OK..but after a few minutes of clicking around it freezes..and if i close it, I have to go to my phone setting and clear the cache or restart my phone before i am able to open the app. Is there a way to have the app tell the phone to clear the catch every few second or just maybe don't allow caching?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
06/03/13 04:31 PM (10 years ago)
Do you have any logcat output? If it closes after you've clicked around the app for a while it could be an out of memory error, do you have a lot of images? **edit** I'm assuming you're on Android...
 
recoore
I hate code!
Profile
Posts: 73
Reg: Mar 01, 2013
Kingston
4,880
like
06/03/13 06:18 PM (10 years ago)
Yes i have a bit of images..,its an android app and i self host ....but is there a solution
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
06/03/13 06:44 PM (10 years ago)
Well, we'd need to know what the error is, are you able to plug your phone into your pc/mac and use it as an emulator? If you're getting an out of memory error in logcat, try crunching the image sizes for a basic possible fix using http://tinypng.org/ for png's or http://www.smushit.com/ysmush.it/ for jpg's If it's other errors we'd need to see the logcat. And if it's out of memory and the image crunching doesn't work, it probably gets technical..
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/04/13 12:02 AM (10 years ago)
This is why I despise Android - the apps run out of memory so darn quickly! Turns out, even using compressed images doesn't give you picture-perfect results (pardon the pun). The app will uncompress the image and take up just as much memory. On top of that, Android allocates a certain amount of memory to each app, regardless of the amount of memory on the device itself. And since a good portion of that memory goes to basic app functions, there's very little left over for graphics. Best bet? Keep the graphics to a minimum, and always use PNG-8 where possible. If you need higher resolution than PNG-8, go with PNG-24. Don't use JPG if you can help it.
 
recoore
I hate code!
Profile
Posts: 73
Reg: Mar 01, 2013
Kingston
4,880
like
06/04/13 01:30 AM (10 years ago)
Thanks, for that info
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
06/04/13 03:32 AM (10 years ago)
@chris1, too right unfortunately. Also, garbage collection seems to be hit and miss with images, you can release an activity from the stack, recycle bitmaps, call GC and the heap still keeps growing!
 
recoore
I hate code!
Profile
Posts: 73
Reg: Mar 01, 2013
Kingston
4,880
like
06/04/13 09:49 AM (10 years ago)
Hi raveyd i am going to use those image program you mentioned and reduce the images
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
06/04/13 10:07 AM (10 years ago)
That's a good start @recoore, hopefully reducing them will be the solution. Report back on what happens, there are some other things we can try if that doesn't work.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.