AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
09/14/12 10:18 AM (13 years ago)

Android crashing, don't know why...

I am building my first combined Ios/Android BT 2.0 app and I am having problems with the app crashing in Android. The app uses tabbed menu layout and on four of those tabs is a button menu vertically aligned, with a photo next to the buttons. The app starts and loads the first screen, the problem is that when I switch between the menus, the app will crash. As a background, here are the steps I take to build the project. Because I have all the plugins loaded in my self hosted control panel, I need to fiddle with the Android build to make it compile in Eclipse. I have the simplemenuadvanced plugin present, which I am not using in this app (I cannot get it to work in Android), so I have to have to remove files from the download, in res/layout andsrc/com.appname/ and I change all references to sparrakorenandroid (because of menusimpleadvanced) until Eclipse is satisfied and the project will compile. And I use google API's and the app will run. Another clue is that when I originally had each button image linked to a URL, the crashes were intermittent. I thought having too many links might be part of the problem, so I put all the images into the app bundle which made the problem worse! (both on the eclipse simulator and on my android device, a zte blade). When the app crashes, I consistently see "external allocation too large for this process" in the logcat - I have part of the logcat here to see if it means anything to anyone; I am not a programmer, so it doesn't mean much to me. 09-14 17:26:31.202: W/ZZ(1161): BT_screen_menuButtons: using button image from project bundle: "l_facebook.png" 09-14 17:26:32.402: E/dalvikvm-heap(1161): externalAllocPossible():footprint 2691056 + extAlloc 26211596 + n 13089924 >= max 30863376 (space for 1960724) footprint : 856048 09-14 17:26:32.402: E/dalvikvm-heap(1161): 13089924-byte external allocation too large for this process. 09-14 17:26:32.402: E/dalvikvm-heap(1161): export hprof info for pid: 1161 09-14 17:26:32.402: E/dalvikvm(1161): hprof: can't open /data/local/logs/heap-dump.hprof-hptemp: No such file or directory. 09-14 17:26:32.472: E/GraphicsJNI(1161): VM won't let us allocate 13089924 bytes 09-14 17:26:32.472: W/dalvikvm(1161): threadid=1: thread exiting with uncaught exception (group=0x2aacc8a0) 09-14 17:26:32.482: E/AndroidRuntime(1161): FATAL EXCEPTION: main 09-14 17:26:32.482: E/AndroidRuntime(1161): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 09-14 17:26:32.482: E/AndroidRuntime(1161): Can anyone give me some advice on how to tackle this one please? Any ideas would be appreciated, I am stumped! Thanks, Alan
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
09/14/12 11:32 AM (13 years ago)
That looks like a memory leak. Have you definitely removed everything to do with menusimpleadvanced? Best to not even have the plugin in the control panel if it doesn't work in android - will only cause problems. Also, is that a capital 'I' in the image name? Try lower case if it is.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
09/14/12 12:40 PM (13 years ago)
Thanks @raveyd. Before, I used BT1.5 for android, but I wanted to pull together a single app that works for both android and iPhone and use my 2.0 Control Panel. I didn't realise that some of the 3rd party plugins meant for ios could interfere with an Android until recently; I'd like to remove menuadvancedsimple from the control panel, but I have other ios apps that use it. I went through all the graphics and made them all lower case. On this example, the image prefix is a lower case l 'as in elle', but I do have numbers embedded in some of the images, such as background_1_img.jpg - I didn't think that would cause a problem as it compiles. I haven't enabled the SD card, would that help?
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
09/14/12 01:30 PM (13 years ago)
Don't know, try it... Numbers and underscores should be ok though. Do you have a lot of images? Or the same image on a number of buttons? Have you removed the manifest entry for the menusimpleadvanced, and the json for it in the config file, and any associated images? Just some suggestions, don't know if they're any help... Is it possible to do separate builds for iOS/Android, so menusimpleadvanced doesn't need to be in the Android downloaded project at all?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
09/14/12 02:25 PM (13 years ago)
Any suggestion is gratefully received @raveyd, it all helps. I haven't looked at the manifest, thanks for that idea. On the images front, overall, I have about 20 buttons with a different image for each. The ios app is certainly faster with them packaged into the build. I've just remembered I may have an unused menusimpleadvanced entry in the project, maybe that is causing a problem? I think I may do a total rebuild in the morning.
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
09/14/12 02:44 PM (13 years ago)
I'd also check the size of the graphics your loading, maybe optimizing them may help with memory errors.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
09/15/12 12:41 PM (13 years ago)
OK, so I found and removed a reference to simpleadvanced menu from the android manifest, I added support for the SD card, tweaked the graphics, all to no avail. I started to delete complete menus from the build, but nothing fixed the basic instability. Then I built a near exact copy of the same app in Buzztouch 1.5 and it is stable. So I am wondering if the mere presence of certain plugins in my control panel causes a problem in Android? The other one that I am suspicious of is the image emailer, but I have most of the ones available from buzztouchmods in my CP.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
09/15/12 02:18 PM (13 years ago)
"So I am wondering if the mere presence of certain plugins in my control panel causes a problem in Android?" Quite likely. The files are in the project whether you use them or not. If there are issues with Android/3rd party plugins, your app will inherit them...
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
09/16/12 09:51 AM (13 years ago)
OK - I think I finally figured it out! When I was sorting out my button images, I now realise I had accidentally sized one to be 1208x1208 pixels instead of 128x128 pixels. iPhone didn't mind, but Android did!. I noticed this today, changed it to 128x128 pixels and all is now good - yippee. Took me about three days to find this but I think (crossed fingers) that I am there. As they say, if it doesn't kill you it makes you stronger... Thanks guys for your support and suggestions.
 

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.