Discussion Forums  >  Crashes, Memory Warnings

Replies: 11    Views: 264

HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
03/12/13 09:01 AM (11 years ago)

Crash on Android

Hi all, I've found a strange error - I've created an app with a menu page as follows: Item 1 -> goes to required login page -> custom url Item 2 -> goes to custom url On first run if I select item 1 all works as expected (get log in needed message). However, if I go to Item 2 and then use the back button on the device and then select item 1 the app crashes. Have tried with both the menu simple and menu with image plug in and on device and simulator. Any suggestions Error in log cat as follows: 03-12 15:59:10.785: E/AndroidRuntime(299): FATAL EXCEPTION: main 03-12 15:59:10.785: E/AndroidRuntime(299): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@460a2c90 is not valid; is your activity running? 03-12 15:59:10.785: E/AndroidRuntime(299): at android.view.ViewRoot.setView(ViewRoot.java:505) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.view.Window$LocalWindowManager.addView(Window.java:424) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.app.Dialog.show(Dialog.java:241) 03-12 15:59:10.785: E/AndroidRuntime(299): at com.test.BT_activity_base.showAlertFromClass(BT_activity_base.java:402) 03-12 15:59:10.785: E/AndroidRuntime(299): at com.test.BT_act_controller.loadScreenObject(BT_act_controller.java:152) 03-12 15:59:10.785: E/AndroidRuntime(299): at com.test.BT_screen_menuListSimple$2.onItemClick(BT_screen_menuListSimple.java:423) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.widget.ListView.performItemClick(ListView.java:3382) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.os.Handler.handleCallback(Handler.java:587) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.os.Handler.dispatchMessage(Handler.java:92) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.os.Looper.loop(Looper.java:123) 03-12 15:59:10.785: E/AndroidRuntime(299): at android.app.ActivityThread.main(ActivityThread.java:4627) 03-12 15:59:10.785: E/AndroidRuntime(299): at java.lang.reflect.Method.invokeNative(Native Method) 03-12 15:59:10.785: E/AndroidRuntime(299): at java.lang.reflect.Method.invoke(Method.java:521) 03-12 15:59:10.785: E/AndroidRuntime(299): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 03-12 15:59:10.785: E/AndroidRuntime(299): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 03-12 15:59:10.785: E/AndroidRuntime(299): at dalvik.system.NativeStart.main(Native Method)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/12/13 12:43 PM (11 years ago)
I don't see anything specific in the error... What was the last logged activity 'before' the error? Cheers! -- Smug
 
HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
like
03/12/13 01:37 PM (11 years ago)
@Smug, Here's the log (all in orange until the fatal error) 03-12 20:34:18.216: W/ZZ(14089): WB_screen_menuImage:handleReportToCloudResults appLastModifiedOnServer (value on server): Tue, 12 Mar 2013 18:24:06 -0700 03-12 20:34:18.226: W/ZZ(14089): BT_fileManager: readTextFileFromCache: "appModified.txt" 03-12 20:34:18.226: W/ZZ(14089): WB_screen_menuImage:handleReportToCloudResults previousModified (value on device): Tue, 12 Mar 2013 18:24:06 -0700 03-12 20:34:18.226: W/ZZ(14089): BT_fileManager: saveTextFileToCache: appModified.txt 03-12 20:34:18.326: W/ZZ(14089): WB_screen_menuImage:handleReportToCloudResults server data not changed, no refresh needed 03-12 20:34:18.676: D/dalvikvm(14089): GC_EXTERNAL_ALLOC freed 2332 objects / 184696 bytes in 40ms 03-12 20:34:19.329: W/ZZ(14089): WB_screen_menuImage:handleItemTap loads screen with itemId: "6425F4ACEF335CB2A51A12E" 03-12 20:34:19.329: W/ZZ(14089): BT_application:getScreenDataByItemId with itemId: = "6425F4ACEF335CB2A51A12E" 03-12 20:34:19.329: W/ZZ(14089): BT_application:getScreenDataByItemId with itemType: "BT_screen_customURL" with nickname: "freetips" 03-12 20:34:19.329: W/ZZ(14089): BT_act_controller:loadScreenObject for screen with itemId: "6425F4ACEF335CB2A51A12E" and itemNickname: "freetips" and itemType: "BT_screen_customURL" 03-12 20:34:19.336: W/ZZ(14089): BT_act_controller:loadScreenObject login required - user IS NOT logged in 03-12 20:34:19.356: D/AndroidRuntime(14089): Shutting down VM 03-12 20:34:19.356: W/dalvikvm(14089): threadid=1: thread exiting with uncaught exception (group=0x400259f8) 03-12 20:34:19.366: E/AndroidRuntime(14089): FATAL EXCEPTION: main 03-12 20:34:19.366: E/AndroidRuntime(14089): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@460dcfd8 is not valid; is your activity running? 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.view.ViewRoot.setView(ViewRoot.java:509) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.view.Window$LocalWindowManager.addView(Window.java:424) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.app.Dialog.show(Dialog.java:241) 03-12 20:34:19.366: E/AndroidRuntime(14089): at com.betfanapp.BT_activity_base.showAlertFromClass(BT_activity_base.java:402) 03-12 20:34:19.366: E/AndroidRuntime(14089): at com.betfanapp.BT_act_controller.loadScreenObject(BT_act_controller.java:152) 03-12 20:34:19.366: E/AndroidRuntime(14089): at com.betfanapp.WB_screen_menuImage$3.onItemClick(WB_screen_menuImage.java:528) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.widget.ListView.performItemClick(ListView.java:3382) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.os.Handler.handleCallback(Handler.java:587) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.os.Handler.dispatchMessage(Handler.java:92) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.os.Looper.loop(Looper.java:144) 03-12 20:34:19.366: E/AndroidRuntime(14089): at android.app.ActivityThread.main(ActivityThread.java:4937) 03-12 20:34:19.366: E/AndroidRuntime(14089): at java.lang.reflect.Method.invokeNative(Native Method) 03-12 20:34:19.366: E/AndroidRuntime(14089): at java.lang.reflect.Method.invoke(Method.java:521) 03-12 20:34:19.366: E/AndroidRuntime(14089): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 03-12 20:34:19.366: E/AndroidRuntime(14089): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 03-12 20:34:19.366: E/AndroidRuntime(14089): at dalvik.system.NativeStart.main(Native Method)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/12/13 02:19 PM (11 years ago)
I'm not entirely sure what's happening, but it seems to be happening here: 03-12 20:34:19.336: W/ZZ(14089): BT_act_controller:loadScreenObject login required - user IS NOT logged in 03-12 20:34:19.356: D/AndroidRuntime(14089): Shutting down VM 03-12 20:34:19.356: W/dalvikvm(14089): threadid=1: thread exiting with uncaught exception (group=0x400259f8) 03-12 20:34:19.366: E/AndroidRuntime(14089): FATAL EXCEPTION: main Looks like when you try to return to the 'logged in' page, something about the 'loadScreenObject' isn't happy. I got that with my project once. Make sure there are NO spaces in your script Json data. Run it through Jsonlint just for good luck too. Cheers! -- Smug
 
HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
like
03/13/13 01:24 PM (11 years ago)
Hi Smug, Have tried that without any success :( Have set up a second app and both seem to be the same. Possibly an error in the BT code somewhere?
 
Faeez A Rahman
Lost but trying
Profile
Posts: 11
Reg: Feb 22, 2013
Kuala Lumpur
3,760
like
03/14/13 12:55 AM (11 years ago)
i'm facing the same problem. have setup three new apps still having the same error.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/14/13 03:54 AM (11 years ago)
You know, I hate to say it, but it's rarely a problem with BT. Not that there haven't been issues, but it's just not that often. I'm no genius, but every time I've had an issue, it ended up being something I didn't completely understand. That's going to happen from time to time; it's just the learning process... I'd retrace my steps and try redoing the app, a little at a time, testing as you go. It's a bit drawn out, but it's the most sure way to find out 'exactly' what's causing your issues. Let me know if there's any thing I can do to help, or if you just want to bounce ideas. Cheers! -- Smug
 
HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
like
03/14/13 04:25 AM (11 years ago)
Hi Smug, Again thanks for the input. I had already tried setting a (Very simple) second app from scratch. It was 3 pages Menu List simple linking to 2 custom urls (customurl1 locked for login, customurl2 not) When the app loads you get the expected results - click customurl1 you get a message telling you it requires log in. When you click customurl2 it opens the page. Now, if you click back at this stage then it takes you to the menulist (homepage). Clicking customurl2 - opens ok However, clicking customurl1 crashes. When you leave the front (menulist page) and go back to it the Menu list crashes when going to any page that requires a log in. To confirm this, I've added a 3rd link to a custom login - when you leave menu and come back to it it works fine- however once you 'lock' the custompage3 it crashes as the rest. Have tried on iOS and theres not the same problem. I've tried - removing all screens, setting one at a time and restarting from there. I've also tried on self hosting and on BT control panel - both with same results.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/14/13 05:29 AM (11 years ago)
If it helps, try swapping out the 'CustomURL' plugin with the 'HTML Doc' plugin, and see if the results change. It seems like you're having an issue with the 'custom URL' plugin. This plugin works fine most of the time, but it does not cache any information. The 'HTML Doc' plugin will cache pages, which, if the user has a login, may be of benefit. It can also be set not to cache. It works 'close enough', but not exactly the same; it may fix your problem. Cheers! -- Smug
 
HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
like
03/14/13 05:46 AM (11 years ago)
Hi Smug, Still the same using any screen for the second link - the minute you leave the menu screen and come back it crashes when it needs to call the log in message. That's me tried 3 apps now all with different screens/plugins locked and the same thing on each (only on android). I really feel I've exhausted everything at this end now and am running out of things to try. Has anyone else reading has set up a similar simple app and had the same results? I really appreciate your help so far.
 
HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
like
03/14/13 08:33 AM (11 years ago)
Problem is at this stage everytime W/ZZ(272): BT_act_controller:loadScreenObject login required - user IS NOT logged in W/WindowManager(58): Attempted to add application window with unknown token HistoryRecord{46202148 com.test/.BT_screen_customURL}. Aborting. I've been searching for solutions online and this type of warning seems to relate to Android Context. With regards to being able to find a solution, I reckon this is know well out of my expertise level. If anybody would be kind enough to set up a similar App and confirm that they are not having the problem it would be really appreciated Thanks In Advance
 
HerrNathan
Aspiring developer
Profile
Posts: 73
Reg: Oct 11, 2011
Stirling
5,830
like
03/14/13 09:26 AM (11 years ago)
OK, I reckon I've found a problem. Within the BT_act_controller I commented the following BT_activity_base.showAlertFromClass(test2_appDelegate.getApplication().getString(R.string.logInRequiredTitle), test2_appDelegate.getApplication().getString(R.string.logInRequiredMessage)); and replaced with a toast. This now displays a toast message saying the login is required and doesnt crash the app. Is this something I could caused when I created the Android project? I'm a novice when it comes to Java and Android so have been learning as I go so am not sure if this is a bug in BT or my fault. Regards
 

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.