patzly / grocy-android

ERP beyond your fridge, now on your phone – An awesome companion app for grocy
https://patrickzedler.com/grocy/
GNU General Public License v3.0
892 stars 85 forks source link

Opening the app after initial setup crashes #27

Closed Aerex closed 4 years ago

Aerex commented 4 years ago

I want to first say that I really like UX design of the app. I am getting this error after second time I run the app.

06-18 08:00:26.988 E/AndroidRuntime(2131): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Menu xyz.zedler.patrick.grocy.MainActivity.H()' on a null object reference

It works when I clear the storage.

patzly commented 4 years ago

Hello, please send us more lines of the crash log because we cannot find a reason based on this single line.

Aerex commented 4 years ago

Here are the logs after I select the app. I filtered to show only the logs from the app.

06-19 15:28:06.991 I/ActivityManager(1259): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=xyz.zedler.patrick.grocy/.MainActivity bnds=[60,1126][204,1270]} from uid 10151 06-19 15:28:07.050 I/ActivityManager(1259): Start proc 21077:xyz.zedler.patrick.grocy/u0a261 for activity xyz.zedler.patrick.grocy/.MainActivity 06-19 15:28:07.149 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:false, currentNightMode:16, newNightMode:16, activityHandlingUiMode:false, baseContextAttached:true, created:false, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@1f6b72a] 06-19 15:28:07.149 D/AppCompatDelegate(21077): updateForNightMode not recreating Activity: xyz.zedler.patrick.grocy.MainActivity@1f6b72a 06-19 15:28:07.149 D/AppCompatDelegate(21077): updateForNightMode. Skipping. Night mode: -1 for host:xyz.zedler.patrick.grocy.MainActivity@1f6b72a 06-19 15:28:07.155 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:true, currentNightMode:16, newNightMode:32, activityHandlingUiMode:false, baseContextAttached:true, created:true, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@1f6b72a] 06-19 15:28:07.155 D/AppCompatDelegate(21077): updateForNightMode attempting to recreate Activity: xyz.zedler.patrick.grocy.MainActivity@1f6b72a 06-19 15:28:07.337 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:true, currentNightMode:16, newNightMode:32, activityHandlingUiMode:false, baseContextAttached:true, created:true, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@1f6b72a] 06-19 15:28:07.337 D/AppCompatDelegate(21077): updateForNightMode attempting to recreate Activity: xyz.zedler.patrick.grocy.MainActivity@1f6b72a 06-19 15:28:07.385 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:false, currentNightMode:32, newNightMode:32, activityHandlingUiMode:false, baseContextAttached:true, created:false, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@d62eb46] 06-19 15:28:07.385 D/AppCompatDelegate(21077): updateForNightMode not recreating Activity: xyz.zedler.patrick.grocy.MainActivity@d62eb46 06-19 15:28:07.385 D/AppCompatDelegate(21077): updateForNightMode. Skipping. Night mode: 2 for host:xyz.zedler.patrick.grocy.MainActivity@d62eb46 06-19 15:28:07.434 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:true, currentNightMode:32, newNightMode:32, activityHandlingUiMode:false, baseContextAttached:true, created:true, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@d62eb46] 06-19 15:28:07.434 D/AppCompatDelegate(21077): updateForNightMode not recreating Activity: xyz.zedler.patrick.grocy.MainActivity@d62eb46 06-19 15:28:07.434 D/AppCompatDelegate(21077): updateForNightMode. Skipping. Night mode: 2 for host:xyz.zedler.patrick.grocy.MainActivity@d62eb46 06-19 15:28:07.452 W/SurfaceFlinger(640): Attempting to set client state on removed layer: Splash Screen xyz.zedler.patrick.grocy#0 06-19 15:28:07.452 W/SurfaceFlinger(640): Attempting to destroy on removed layer: Splash Screen xyz.zedler.patrick.grocy#0 06-19 15:28:07.529 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:false, currentNightMode:32, newNightMode:32, activityHandlingUiMode:false, baseContextAttached:true, created:false, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@7783d3b] 06-19 15:28:07.529 D/AppCompatDelegate(21077): updateForNightMode not recreating Activity: xyz.zedler.patrick.grocy.MainActivity@7783d3b 06-19 15:28:07.529 D/AppCompatDelegate(21077): updateForNightMode. Skipping. Night mode: 2 for host:xyz.zedler.patrick.grocy.MainActivity@7783d3b 06-19 15:28:07.572 D/AppCompatDelegate(21077): updateForNightMode [allowRecreation:true, currentNightMode:32, newNightMode:32, activityHandlingUiMode:false, baseContextAttached:true, created:true, canReturnDifferentContext:true, host:xyz.zedler.patrick.grocy.MainActivity@7783d3b] 06-19 15:28:07.572 D/AppCompatDelegate(21077): updateForNightMode not recreating Activity: xyz.zedler.patrick.grocy.MainActivity@7783d3b 06-19 15:28:07.572 D/AppCompatDelegate(21077): updateForNightMode. Skipping. Night mode: 2 for host:xyz.zedler.patrick.grocy.MainActivity@7783d3b 06-19 15:28:07.602 E/AndroidRuntime(21077): Process: xyz.zedler.patrick.grocy, PID: 21077 06-19 15:28:07.602 E/AndroidRuntime(21077): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Menu xyz.zedler.patrick.grocy.MainActivity.H()' on a null object reference 06-19 15:28:07.602 E/AndroidRuntime(21077):   at xyz.zedler.patrick.grocy.E2.H8.Y1(SourceFile:1) 06-19 15:28:07.602 E/AndroidRuntime(21077):  at xyz.zedler.patrick.grocy.E2.H8.f1(SourceFile:2) 06-19 15:28:07.602 E/AndroidRuntime(21077):  at xyz.zedler.patrick.grocy.E2.n7.a(Unknown Source:2) 06-19 15:28:07.602 E/AndroidRuntime(21077):   at xyz.zedler.patrick.grocy.F2.Q.o(SourceFile:4) 06-19 15:28:07.602 E/AndroidRuntime(21077):    at xyz.zedler.patrick.grocy.F2.t.a(Unknown Source:4) 06-19 15:28:07.602 E/AndroidRuntime(21077):    at xyz.zedler.patrick.grocy.I2.a.a(Unknown Source:4) 06-19 15:28:07.604 W/ActivityManager(1259): Force finishing activity xyz.zedler.patrick.grocy/.MainActivity 06-19 15:28:07.626 W/InputDispatcher(1259): channel 'f168cde xyz.zedler.patrick.grocy/xyz.zedler.patrick.grocy.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 06-19 15:28:07.626 E/InputDispatcher(1259): channel 'f168cde xyz.zedler.patrick.grocy/xyz.zedler.patrick.grocy.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 06-19 15:28:07.628 I/WindowManager(1259): WIN DEATH: Window{f168cde u0 xyz.zedler.patrick.grocy/xyz.zedler.patrick.grocy.MainActivity} 06-19 15:28:07.628 W/InputDispatcher(1259): Attempted to unregister already unregistered input channel 'f168cde xyz.zedler.patrick.grocy/xyz.zedler.patrick.grocy.MainActivity (server)' 06-19 15:28:07.629 I/ActivityManager(1259): Process xyz.zedler.patrick.grocy (pid 21077) has died: fore TOP 06-19 15:28:07.638 W/SurfaceFlinger(640): Attempting to destroy on removed layer: AppWindowToken{13c10cc token=Token{8018aff ActivityRecord{3f2921e u0 xyz.zedler.patrick.grocy/.MainActivity t4707}}}#0

Below are the logs before the null pointer exception occurs.

downloadUserSettings: settings = {"night_mode_enabled":"0","auto_night_mode_enabled":"0","auto_night_mode_time_range_from":"20:00","auto_night_mode_time_range_to":"07:00","auto_night_mode_time_range_goes_over_midnight":true,"currently_inside_night_mode_range":"1","auto_reload_on_db_change":true,"keep_screen_on":false,"keep_screen_on_when_fullscreen_card":false,"product_presets_location_id":"2","product_presets_product_group_id":-1,"product_presets_qu_id":"8","stock_expring_soon_days":5,"stock_default_purchase_amount":0,"stock_default_consume_amount":1,"scan_mode_consume_enabled":false,"scan_mode_purchase_enabled":"0","show_icon_on_stock_overview_page_when_product_is_on_shopping_list":true,"shopping_list_to_stock_workflow_auto_submit_when_prefilled":"0","shopping_list_show_calendar":false,"shopping_list_disable_auto_compact_view_on_mobile":"1","recipe_ingredients_group_by_product_group":false,"chores_due_soon_days":5,"batteries_due_soon_days":5,"tasks_due_soon_days":5,"show_clock_in_header":"1","quagga2_numofworkers":4}

 downloadConfig: config = {"MODE":"production","CULTURE":"en","CURRENCY":"$","BASE_URL":"\/","STOCK_BARCODE_LOOKUP_PLUGIN":"DemoBarcodeLookupPlugin","DISABLE_URL_REWRITING":false,"CALENDAR_FIRST_DAY_OF_WEEK":"","CALENDAR_SHOW_WEEK_OF_YEAR":true,"BASE_PATH":"","ENTRY_PAGE":"stock","DISABLE_AUTH":false,"DISABLE_BROWSER_BARCODE_CAMERA_SCANNING":false,"MEAL_PLAN_FIRST_DAY_OF_WEEK":"","FEATURE_FLAG_STOCK":true,"FEATURE_FLAG_SHOPPINGLIST":true,"FEATURE_FLAG_RECIPES":true,"FEATURE_FLAG_CHORES":true,"FEATURE_FLAG_TASKS":true,"FEATURE_FLAG_BATTERIES":true,"FEATURE_FLAG_EQUIPMENT":true,"FEATURE_FLAG_CALENDAR":true,"FEATURE_FLAG_STOCK_PRICE_TRACKING":true,"FEATURE_FLAG_STOCK_LOCATION_TRACKING":true,"FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING":true,"FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING":true,"FEATURE_FLAG_STOCK_PRODUCT_FREEZING":true,"FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD":true,"FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS":true,"FEATURE_FLAG_CHORES_ASSIGNMENTS":true,"FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT":true,"FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA":true}

downloadSystemInfo: {"grocy_version":{"Version":"2.7.1","ReleaseDate":"2020-04-17"},"php_version":"7.4.3","sqlite_version":"3.31.1"}

downloadLocations: [Location(Fridge), Location(Pantry), Location(Bathroom Cupboard), Location(Kitchen Cupboard), Location(Freezer), Location(Laundry)]

Let me know if you need more information

dominiczedler commented 4 years ago

Please let us know whether this bug still occurs and if yes, which Android version you have. This bug is hard to fix, because we don't know the location in the code where it occurs.

It would really help if you could open this app repository in Android Studio and write us the error stack trace after the bug occurs. This usually contains more information than the normal Android logs. If you don't have enough Android knowledge, we simply leave this issue open and maybe someone finds the source of the bug some day.

Aerex commented 4 years ago

Let me get back to you. I have Android knowledge so I will look into getting a PR to fix this issue. I realized that not enabling dark mode stops the crashes. It may just be an issue on my phone. I will close this issue for the time being. Thanks for looking into this.

patzly commented 4 years ago

Ok perfect! This dark mode setting is a bit weird, it restarted the app on our devices sometimes in a loop, but we thought we had fixed this.