My application was running perfectly fine on my emulator (Google Pixel 2), but when I tried launching the app to a physical device (Galaxy Note 20) I just get white screen, there is probably something going wrong with physical device being much newer than the emulator. I tried :
flutter upgrade
flutter clean
and changed minSDK
to 23 instead of 16. I also tried upgrading the dependences to newer versions, but do to incompatibility issues I had to reset them back to older versions.
When launching to the emulator I get this:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
Debug service listening on ws://127.0.0.1:54695/lfhRZFuIGMw=/ws
Syncing files to device Android SDK built for x86...
D/EGL_emulation(21851): eglMakeCurrent: 0xebea1000: ver 3 0 (tinfo 0xcc025380)
D/eglCodecCommon(21851): setVertexArrayObject: set vao to 0 (0) 1 0
and when launching to the physical device, this is what I get:
Launching lib\main.dart on SM N985F in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
Debug service listening on ws://127.0.0.1:54580/fefT1rs2LOk=/ws
Syncing files to device SM N985F...
E/flutter (22977): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The getter 'length' was called on null.
E/flutter (22977): Receiver: null
E/flutter (22977): Tried calling: length
E/flutter (22977): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
E/flutter (22977): #1 _parseJson (dart:convert-patch/convert_patch.dart:39:28)
E/flutter (22977): #2 JsonDecoder.convert (dart:convert/json.dart:506:36)
E/flutter (22977): #3 JsonCodec.decode (dart:convert/json.dart:157:41)
E/flutter (22977): #4 jsonDecode (dart:convert/json.dart:96:10)
E/flutter (22977): #5 getList (package:realtime_test/main.dart:27:30)
E/flutter (22977): <asynchronous suspension>
E/flutter (22977): #6 main (package:realtime_test/main.dart:16:3)
E/flutter (22977): <asynchronous suspension>
E/flutter (22977):
I/ViewRootImpl@46a8966[MainActivity](22977): ViewPostIme pointer 0
I/ViewRootImpl@46a8966[MainActivity](22977): MSG_WINDOW_FOCUS_CHANGED 0 1
I/SurfaceControl(22977): release : mNativeObject = 476773762736 - Surface(name=Surface(name=a38c4 InputMethod)/@0x7a23a73 - animation-leash)/@0xa41f0a1 / android.view.-$$Lambda$Rl1VZmNJ0VZDLK0BAbaVGis0rrA.accept:2 android.view.InsetsSourceControl.release:170 android.view.InsetsSourceConsumer.setControl:202 android.view.ImeInsetsSourceConsumer.setControl:154
I/SurfaceControl(22977): nativeRelease nativeObject s[476773762736]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773762736]
I/SurfaceControl(22977): release : mNativeObject = 476773765760 - Surface(name=Surface(name=2a9e95b NavigationBar0)/@0x87e7f82 - animation-leash)/@0x2190368 / android.view.-$$Lambda$Rl1VZmNJ0VZDLK0BAbaVGis0rrA.accept:2 android.view.InsetsSourceControl.release:170 android.view.InsetsSourceConsumer.setControl:202 android.view.InsetsController.onControlsChanged:833
I/SurfaceControl(22977): nativeRelease nativeObject s[476773765760]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773765760]
I/SurfaceControl(22977): release : mNativeObject = 476773740672 - Surface(name=Surface(name=6106940 StatusBar)/@0xd1b68b8 - animation-leash)/@0xe205381 / android.view.-$$Lambda$Rl1VZmNJ0VZDLK0BAbaVGis0rrA.accept:2 android.view.InsetsSourceControl.release:170 android.view.InsetsSourceConsumer.setControl:202 android.view.InsetsController.onControlsChanged:833
I/SurfaceControl(22977): nativeRelease nativeObject s[476773740672]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773740672]
D/InputTransport(22977): Input channel destroyed: 'ClientS', fd=122
I/SurfaceControl(22977): release : mNativeObject = 476773811120 - Surface(name=Surface(name=a38c4 InputMethod)/@0x7a23a73 - animation-leash)/@0x2fda6bd / android.view.-$$Lambda$Rl1VZmNJ0VZDLK0BAbaVGis0rrA.accept:2 android.view.InsetsSourceControl.release:170 android.view.InsetsSourceConsumer.setControl:202 android.view.ImeInsetsSourceConsumer.setControl:154
I/SurfaceControl(22977): nativeRelease nativeObject s[476773811120]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773811120]
I/SurfaceView(22977): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{a0c34fd V.E...... ........ 0,0-1440,3035} of ViewRootImpl@46a8966[MainActivity]
I/SurfaceView(22977): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{a0c34fd V.E...... ........ 0,0-1440,3035}
I/mali_egl(22977): eglDestroySurface() in
I/mali_winsys(22977): delete_surface() [1440x3035] return
I/mali_egl(22977): eglDestroySurface() out
W/libEGL (22977): EGLNativeWindowType 0x7021f7c4a0 disconnect failed
D/SurfaceControl(22977): hide : mNativeObject = 477310781072 - sc.mNativeObject = 476773737760 - Surface(name=SurfaceView - com.example.realtime_test/com.example.realtime_test.MainActivity@a0c34fd@0)/@0x4db9fa2
D/SurfaceControl(22977): nativeSetFlags Done : Surface(name=SurfaceView - com.example.realtime_test/com.example.realtime_test.MainActivity@a0c34fd@0)/@0x4db9fa2
I/SurfaceView(22977): remove() from RT android.view.SurfaceView$2@1fbc4b2 Surface(name=SurfaceView - com.example.realtime_test/com.example.realtime_test.MainActivity@a0c34fd@0)/@0x4db9fa2
I/SurfaceControl(22977): release : mNativeObject = 476773737760 - Surface(name=SurfaceView - com.example.realtime_test/com.example.realtime_test.MainActivity@a0c34fd@0)/@0x4db9fa2 / android.view.SurfaceControl$Transaction.remove:3449 android.view.SurfaceView$2.positionLost:1561 android.graphics.RenderNode$CompositePositionUpdateListener.positionLost:313 <bottom of call stack>
I/SurfaceControl(22977): nativeRelease nativeObject s[476773737760]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773737760]
I/SurfaceControl(22977): release : mNativeObject = 476773742576 - Surface(name=Background for -SurfaceView - com.example.realtime_test/com.example.realtime_test.MainActivity@a0c34fd@0)/@0x1cd2c03 / android.view.SurfaceControl$Transaction.remove:3449 android.view.SurfaceView$2.positionLost:1562 android.graphics.RenderNode$CompositePositionUpdateListener.positionLost:313 <bottom of call stack>
I/SurfaceControl(22977): nativeRelease nativeObject s[476773742576]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773742576]
I/mali_egl(22977): eglDestroySurface() in
I/mali_winsys(22977): delete_surface() [1440x3088] return
I/mali_egl(22977): eglDestroySurface() out
W/libEGL (22977): EGLNativeWindowType 0x7021f7a290 disconnect failed
I/SurfaceControl(22977): release : mNativeObject = 476773781888 - Surface(name=null)/@0x516d780 / android.view.SurfaceControl.assignNativeObject:567 android.view.SurfaceControl.readFromParcel:1115 android.view.IWindowSession$Stub$Proxy.relayout:1777 android.view.ViewRootImpl.relayoutWindow:8953
I/SurfaceControl(22977): nativeRelease nativeObject s[476773781888]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773781888]
I/SurfaceControl(22977): assignNativeObject: nativeObject = 0 Surface(name=null)/@0x516d780 / android.view.SurfaceControl.readFromParcel:1115 android.view.IWindowSession$Stub$Proxy.relayout:1777 android.view.ViewRootImpl.relayoutWindow:8953 android.view.ViewRootImpl.performTraversals:3312 android.view.ViewRootImpl.doTraversal:2575 android.view.ViewRootImpl$TraversalRunnable.run:9910 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995
I/SurfaceControl(22977): assignNativeObject: nativeObject = 0 Surface(name=null)/@0x8186ac0 / android.view.SurfaceControl.readFromParcel:1115 android.view.IWindowSession$Stub$Proxy.relayout:1787 android.view.ViewRootImpl.relayoutWindow:8953 android.view.ViewRootImpl.performTraversals:3312 android.view.ViewRootImpl.doTraversal:2575 android.view.ViewRootImpl$TraversalRunnable.run:9910 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995
I/SurfaceControl(22977): release : mNativeObject = 476773737200 - Surface(name=Bounds for - com.example.realtime_test/com.example.realtime_test.MainActivity@0)/@0xd62f1b9 / android.view.ViewRootImpl.destroySurface:2437 android.view.ViewRootImpl.relayoutWindow:8990 android.view.ViewRootImpl.performTraversals:3312 android.view.ViewRootImpl.doTraversal:2575
I/SurfaceControl(22977): nativeRelease nativeObject s[476773737200]
I/SurfaceControl(22977): nativeRelease nativeObject e[476773737200]
I/ViewRootImpl@46a8966[MainActivity](22977): Relayout returned: old=(0,0,1440,3088) new=(0,0,1440,3088) req=(1440,3088)8 dur=6 res=0x5 s={false 0} ch=true fn=2
I/SurfaceView(22977): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{a0c34fd V.E...... ........ 0,0-1440,3035} of ViewRootImpl@46a8966[MainActivity]
I/ViewRootImpl@46a8966[MainActivity](22977): stopped(true) old=false
So there is clearly something going wrong but I don't know what's the issue.