GoogleCloudPlatform/iot-smart-home-cloud

Nothing on screen after app building ... these errors are showing

robocircuit opened this issue · 3 comments

2020-05-19 01:48:55.116 8348-8348/? E/e.devicemanage: Unknown bits set in runtime_flags: 0x8000
2020-05-19 01:48:55.928 8348-8381/com.example.devicemanager E/Perf: Fail to get file list com.example.devicemanager
2020-05-19 01:48:55.929 8348-8381/com.example.devicemanager E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-05-19 01:48:55.929 8348-8381/com.example.devicemanager E/Perf: Fail to get file list com.example.devicemanager
2020-05-19 01:48:55.929 8348-8381/com.example.devicemanager E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-05-19 01:48:57.064 8348-8385/com.example.devicemanager E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
If you're running an application and need to access the binary messenger before runApp() has been called (for example, during plugin initialization), then you need to explicitly call the WidgetsFlutterBinding.ensureInitialized() first.
If you're running a test, you can call the TestWidgetsFlutterBinding.ensureInitialized() as the first line in your test's main() method to initialize the binding.
#0 defaultBinaryMessenger. (package:flutter/src/services/binary_messenger.dart:76:7)
#1 defaultBinaryMessenger (package:flutter/src/services/binary_messenger.dart:89:4)
#2 MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:140:62)
#3 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:146:35)
#4 OptionalMethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:435:18)
#5 SystemChrome.setPreferredOrientations (package:flutter/src/services/system_chrome.dart:239:35)
#6 main (package:devicemanager/main.dart:24:22)
#7 _runMainZoned.. (dart:ui/hooks.dart:241:25)
#8 _rootRun (dart:async/zone.dart:1184:13)
#9 _CustomZone.run (dart:async/zone.dart:1077:19)
#10 _runZoned (dart:async/zone.dart:1619:10)
#11 runZonedGuarded (dart:async/zone.dart:1608:12)
#12 _runMainZoned. (dart:ui/hooks.dart:233:5)
#13 _startIsolate. (dart:isolate-patch/isolate_patch.dart:301:19)
#14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

This seems to be related to flutter/flutter#46825

You can fix this by adding WidgetsFlutterBinding.ensureInitialized(); to the beginning of main(). Will publish the fix to this sample shortly.

Thank you for the solution. it worked!!
BUT! after clicking sign in with google and choosing account it is showing "unable to sign in"

2020-05-19 22:10:18.220 21462-21462/? E/e.devicemanage: Unknown bits set in runtime_flags: 0x8000
2020-05-19 22:10:18.714 21462-21492/? E/Perf: Fail to get file list com.example.devicemanager
2020-05-19 22:10:18.715 21462-21492/? E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-05-19 22:10:18.715 21462-21492/? E/Perf: Fail to get file list com.example.devicemanager
2020-05-19 22:10:18.715 21462-21492/? E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array