Discussion Forums  >  Crashes, Memory Warnings

Replies: 38    Views: 420

ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
06/05/12 03:46 PM (12 years ago)

java.lang.NullPointerException error - Android v2.0

I published my app yesterday on Google Play and checked on it and found an error (see below). Any assistance with this is appreciated. If you need more info please let me know. Exception class java.lang.NullPointerException Source method BT_viewUtilities.updateBackgroundColorsForScreen() Link to app: https://play.google.com/store/apps/details?id=com.yvonnelaubedesigns.locustgrove&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS55dm9ubmVsYXViZWRlc2lnbnMubG9jdXN0Z3JvdmUiXQ..
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/05/12 04:04 PM (12 years ago)
Argh! The dreaded backgroundcolors crash! This is a known issue...one that hasn't been fixed yet...and which "might" have the workaround of removing background colors (defaulting to the normal black) for your app. Mark
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/05/12 06:02 PM (12 years ago)
Ugh - that is a bummer. My app is so simple that the color kind of is the "brand" that ties it to the historic site. Something I will have to think about.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/05/12 06:06 PM (12 years ago)
Well, another thing to consider is that it doesn't crash on every device...just some. I'd monitor crash reports for a bit and see what happens. This could possibly be the only one you get! Mark
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/05/12 06:08 PM (12 years ago)
True - I'll wait a week or two and see how it goes.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/08/12 09:48 AM (12 years ago)
I visited the client and they were okay with changing the background colors to black if it can resolve the crashing. I changed all of the applicable screens to to default color (leaving the color field blank) and saved and updated config and checked it out - still crashing. I then went on to change all of the nav. bar background colors to the default color (leaving the color field blank) and saved and updated config and checked it out - still crashing. The error in the developer console is the same: Exception class java.lang.NullPointerException Source method BT_viewUtilities.updateBackgroundColorsForScreen() The details from the console: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yvonnelaubedesigns.locustgrove/com.locustgrove.BT_screen_menuListSimple}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3687) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.locustgrove.BT_viewUtilities.updateBackgroundColorsForScreen(BT_viewUtilities.java:41) at com.locustgrove.BT_screen_menuListSimple.onCreate(BT_screen_menuListSimple.java:117) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) ... 11 more What I am seeing from my device is that it crashes from the following actions: 1) Sometimes when loading the splashscreen 2) Simple menu>custom html (image map)>youtube (finish video to go back to map)>custom html>menu - crash. It is the process of going back from the custom html/image map to the simple menu that crashes. It is intermittent, meaning it doesn't crash every time but enough to put off a user (who would likely only be using this app once - while touring the historic site). If you can think of anything else to try and resolve this I would appreciate it.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/09/12 06:17 AM (12 years ago)
Hi there, can anyone help me with the above?
 
ehwright
Aspiring developer
Profile
Posts: 57
Reg: Feb 21, 2012
Perth
2,370
like
06/11/12 03:52 AM (12 years ago)
I found that I was getting this problem too. In my case it was when I clicked on driving directions, and then the back button in google maps. My application would crash with the same error output as you. After looking around and not finding a fix I ended up taking a slightly more drastic approach and commented out all references in the code to the setting background colours. this seems to have solved the problem. Like you, my app only crashed sometimes and only on some devices. At this stage it looks like my app is working fine now. If you want to take this approach you can still have a background with an image instead of setting the colour. Of course it is the sledgehammer solution, I only did it because I was getting desperate.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/11/12 04:40 AM (12 years ago)
@ehwright - thank you for the advice. I will try this tonight and let you know. I was getting discouraged and I will try anything. I like your idea of using a background image for the color.
 
ehwright
Aspiring developer
Profile
Posts: 57
Reg: Feb 21, 2012
Perth
2,370
like
06/11/12 06:42 AM (12 years ago)
Sorry to have to say this, but I did not, in fact fix the problem by commenting out the code. All it did was make a nullpointerexception for the next method - getNavBarForScreen. So it looks like the problem is with the call to BT_viewUtilities. So stuck again
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/11/12 07:53 AM (12 years ago)
darn! It is hard to not get completely discouraged. I am not sure what to do.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/11/12 03:19 PM (12 years ago)
@GoNorthWest - would this problem be something a professional developer can fix? Or would building this in 1.5 be more stable? I am open to suggestions... I am at a loss and need help. The app seems to crash 9 times out of 10.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/11/12 03:21 PM (12 years ago)
I think that somebody with professional development experience...especially debugging java programming...could help a lot. I'm not sure if previous versions are better or not, with respect to this problem. BT v2.0 for Android is the same code as BT v1.5 for Android. Mark
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/11/12 03:23 PM (12 years ago)
Thank you for the quick reply. Can you recommend anyone or should I create a new post with the request?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/11/12 03:25 PM (12 years ago)
There have been a number of posts on this already, and nobody around here seems to have the skill to deal with it. A few have tried, but no resolution yet. Buzztouch is aware of it, but it's a tricky problem, and the of course have day jobs. Unfortunately I'm really not sure what to advise at this point! Mark
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/11/12 03:28 PM (12 years ago)
Thank you - I'll see what/who I can find online.
 
ehwright
Aspiring developer
Profile
Posts: 57
Reg: Feb 21, 2012
Perth
2,370
like
06/13/12 07:18 AM (12 years ago)
Hi, I've had another long look at this and I think I've finally made some headway. The log cat has been very useful.. The app is crashing due to a null pointer exception which occurs after I leave my app to go to another. While in the other app, my app has been terminated, probably due to android killing things off for memory. When it restarts, it tries to get the screen data via: this.screenData = myapp_appDelegate.rootApp.getCurrentScreenData(); this.screenData ends up being null and then when it is used in the call to BT_viewUtilities.updateBackgroundColorsForScreen(this, this.screenData); and LinearLayout navBar = BT_viewUtilities.getNavBarForScreen(this, this.screenData); it results in the null pointer exception. I tried all sorts of things to get around this but found that the easiest thing to do was to check whether it was null, and if so, force the application to go back to its home screen via: if (this.screenData == null) { BT_debugger.showIt("screendata is null"); Intent i = getBaseContext().getPackageManager() .getLaunchIntentForPackage( getBaseContext().getPackageName() ); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); etc. Because this was happening in my maps screen after I clicked on driving directions and going to google maps, I have the code in BT_screen_maps. This means that instead of the screen going black and then showing me the null pointer exception message, the screen goes black and then the app starts up again at the home screen. If anyone else has any ideas they would be most welcome.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/14/12 07:25 AM (12 years ago)
@ehwright - I am so impressed with your ability to figure this stuff out. I am more of a visual person (WYSIWYG) so the code overwhelms me. What you are saying makes sense though as it is the behavior I am experiencing. One other place my app crashes is sometimes when loading on the original opening. I have a feeling it might coincide with other apps being opened but cant tell for sure. For your last comment to work did you keep the references to background colors commented out or did you revert that back?
 
ehwright
Aspiring developer
Profile
Posts: 57
Reg: Feb 21, 2012
Perth
2,370
like
06/14/12 04:33 PM (12 years ago)
I reverted all the commented out sections back since it really had nothing to do with the colours. I've been testing on the phone that was having the problem and there's been no crashes since. I've noticed that it is reverting back to the home screen every now and again which is when it would have crashed. I'm considering putting in if statements to most of the plugins to check whether the screen data is null before doing anything else. I don't know what to say about the app crashing on opening. I'd love for a serious coder to have a look at this and tell me if I'm on the right track.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/15/12 02:13 PM (12 years ago)
@GoNorthWest - I was just mulling this issue over and wondered if you know if this glitch is something that happens all the time (like 10 out of 10) or just really random? Do you think it be worth it to try and recreate the entire app over from scratch?
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/26/12 12:29 PM (12 years ago)
FYI.. I took a little time away from the app (because it was making me crazy). Yesterday I tried making a new app from scratch to see if it would give the same results and alas - it does. I still get the backgroundcolors crash. It is extremely frustrating as I intentionally did not change any of the background color settings to see if this would make a difference - but no luck.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/26/12 12:33 PM (12 years ago)
Bummer that you're still having this issue! Seems like it happens very consistently in your environment, though, which is a good thing because it helps for debug. Are you using an Emulator for testing, or an actual device? If a device, what Android version? If the Emulator, what settings do you have for your Emulator? Mark
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/26/12 12:40 PM (12 years ago)
Hi Mark, Thanks for the help. I am using my device, Android 2.3.6. I updated the app in Google Play as it did not seem to be giving me troubles prior to uploading. Since I have downloaded it it is crashing (still intermittently). Direct link to the newest .apk file in my dropbox: https://dl.dropbox.com/u/55663560/locustgrove.apk
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/26/12 12:49 PM (12 years ago)
I don't have a device yet, but I'll see if I can configure an emulator with that level of code and see what happens. I'm in no way a Java programmer, but it would be interesting to figure this out! Mark
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/26/12 02:12 PM (12 years ago)
Interesting, but Android 2.3.3 is the closest I can download. Not even a closer obsolete version is showing up.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/26/12 02:20 PM (12 years ago)
That may be because I am incorrect. I am assuming when I look up the info on my phone it is the "firmware" version. I could be wrong though as it isn't anywhere obvious what I am running.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/26/12 02:25 PM (12 years ago)
I just plugged my phone into eclipse and tried to run the app on it. It confirmed it is 2.3.6.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/26/12 02:27 PM (12 years ago)
No problem. Just kinda updating you with where I am on this. Hopefully the .3 difference isn't crucial! By the way...don't expect something to come of this super soon. Like I said...just dabbling here, trying to understand it all better. Could very well be that I get absolutely nowhere!
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/26/12 02:45 PM (12 years ago)
I understand and appreciate the look through. I will keep my fingers crossed!
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/26/12 02:49 PM (12 years ago)
Any chance you'd be willing to send me your source package so I can debug that way? MrkFleming at gmail dot com
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
06/26/12 02:53 PM (12 years ago)
absolutely! on its way...
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/26/12 02:56 PM (12 years ago)
Got it...thanks!
 
mongerrl
Aspiring developer
Profile
Posts: 12
Reg: Apr 14, 2012
Mount Sidney, V...
10,020
like
06/27/12 06:38 AM (12 years ago)
ylaube73: I just published my app yesterday and got the same error in my Developer Console: BT_viewUtilities.updateBackgroundColorsForScreen(). GoNorthWest: I hope you find a solution to this, as I am at a total loss as to what to do. My package is at https://play.google.com/store/apps/details?id=com.veaphoneapp&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS52ZWFwaG9uZWFwcCJd . If I can help you in any way, let me know. BTW, thanks for all the help your "How to's" and Forum posts have given me in the past that enabled me to get this app as far as I have.
 
koopakid08
Aspiring developer
Profile
Posts: 74
Reg: Jun 14, 2011
earth
1,540
like
07/01/12 08:05 PM (12 years ago)
Just popping in to say I also have seen this problem in my app and hopefully you guys that are much more knowledgeable than me will be able to fix it in the future.
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
07/30/12 01:52 PM (11 years ago)
Hi GoNorthWest, I had been away for a bit but am back and thought I would check in to see if there have been any developments on this front. I tried my app and am still having the same error issue but can tell you what/where I am that this is occurring: 1) At the initial app start up prior to the splash screen. It does not crash there every time - it is hit or miss. 2) When I go from my main menu to my "explore by map" html screen that contains an image map with links to Youtube. Once I watch the video and use my phone's back button I can get back to the image map but if I use the back button again to get back to the app's main menu it crashes. Again, sometimes it works - sometimes it doesn't. Maybe this info will help.
 
Bigfishtools
I hate code!
Profile
Posts: 152
Reg: Dec 06, 2011
benicia, ca
1,520
like
08/18/12 09:34 AM (11 years ago)
LOL this has been going on for a while...... no one here cares. They act like they do but not really. PJ posted this: http://www.buzztouch.com/forum/thread.php?tid=1E30F545526AE2DF6A9AD49 I have not tried it yet, hopefully it will work then on to the other Buzztouch specific errors.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
08/18/12 10:55 AM (11 years ago)
I disagree that nobody cares...certainly not the case with me! But, I'm not a programmer, it's a pretty tough, somewhat intermittent problem, and I do have a day job! Mark
 
ehwright
Aspiring developer
Profile
Posts: 57
Reg: Feb 21, 2012
Perth
2,370
like
11/21/12 07:05 PM (11 years ago)
Hi again, have you seen this post, I found it today, about to try it, looks like it's the one we've been waiting for https://www.buzztouch.com/forum/thread.php?tid=8B5CBFBAAAA9373BB96B9E7
 
ylaube73
Android Fan
Profile
Posts: 92
Reg: Jan 30, 2012
Poughkeepsie, N...
1,720
like
11/26/12 02:40 PM (11 years ago)
Hey Ehwright - thanks for the post (which notified me via email). I had started another project and hadn't gotten back to working on this one. Did you try the fix yet? How did it go? I will try and take a look at this when I get a free moment.
 

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.