Skip to content

[device_info_plus] Error 'Null' is not a subtype of type 'String' on Android #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iqfareez opened this issue Mar 13, 2021 · 15 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@iqfareez
Copy link

iqfareez commented Mar 13, 2021

System info

Issue occurs on: Android
Plugin name: device_info_plus: ^1.0.0
Flutter doctor output: View logs below

Steps to Reproduce

Run the example code on Android.

It worked on chrome anyway.

Logs

 Running with sound null safety 
D/ViewRootImpl@d0d3d16[MainActivity](16206): Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x1 surface={true 3823394816} changed=false
E/flutter (16206): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: type 'Null' is not a subtype of type 'String'
E/flutter (16206): #0      new List.from (dart:core-patch/array_patch.dart:40:5)
E/flutter (16206): #1      AndroidDeviceInfo._fromList (package:device_info_plus_platform_interface/model/android_device_info.dart:144:12)
E/flutter (16206): #2      AndroidDeviceInfo.fromMap (package:device_info_plus_platform_interface/model/android_device_info.dart:137:23)
E/flutter (16206): #3      MethodChannelDeviceInfo.androidInfo (package:device_info_plus_platform_interface/method_channel/method_channel_device_info.dart:19:30)
E/flutter (16206): <asynchronous suspension>
E/flutter (16206): #4      DeviceInfoPlugin.androidInfo (package:device_info_plus/device_info_plus.dart:65:36)
E/flutter (16206): <asynchronous suspension>
E/flutter (16206): #5      _MyExampleAppState.initPlatformState (package:device_information/view/example.dart:39:37)
E/flutter (16206): <asynchronous suspension>
E/flutter (16206):

flutter doctor -v

[√] Flutter (Channel beta, 2.0.0, on Microsoft Windows [Version 10.0.19042.804], locale en-MY)
    • Flutter version 2.0.0 at C:\Users\Iqmal\fvm\default
    • Framework revision 60bd88df91 (9 days ago), 2021-03-03 09:13:17 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Iqmal\AppData\Local\Android\Sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = C:\Users\Iqmal\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.0)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.9.31025.194
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.54.2)
    • VS Code at C:\Users\Iqmal\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.20.0

[√] Connected device (4 available)
    • SM J730G (mobile) • 5200b38ceaf7a473 • android-arm    • Android 9 (API 28)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Version 10.0.19042.804]   
    • Chrome (web)      • chrome           • web-javascript • Google Chrome 88.0.4324.190
    • Edge (web)        • edge             • web-javascript • Microsoft Edge 89.0.774.50

• No issues found!
@iqfareez iqfareez added the bug Something isn't working label Mar 13, 2021
@iqfareez iqfareez changed the title [device_info_plus ] Error 'Null' is not a subtype of type 'String' on Android [device_info_plus] Error 'Null' is not a subtype of type 'String' on Android Mar 13, 2021
@jhomlala
Copy link

jhomlala commented Mar 18, 2021

Any plans for fixing that issue? It would be nice if it could be fixed soon :)

@iqfareez
Copy link
Author

iqfareez commented Mar 26, 2021

Any plans for fixing that issue? It would be nice if it could be fixed soon :)

Agreed. Please fix this issue asap.

@lff5
Copy link

lff5 commented Mar 26, 2021

Hi. I depend on it too.

@miquelbeltran
Copy link
Member

miquelbeltran commented Mar 29, 2021

A fix has been published under device_info_plus_platform_interface 1.0.1, to get it, please run flutter pub upgrade on your projects.

Be sure that device_info_plus_platform_interface 1.0.1 appears when "Resolving dependencies"

@iqfareez
Copy link
Author

Tested ✔. It works! Thank you @miquelbeltran .

@tomasweigenast
Copy link

@miquelbeltran here it does not work

@miquelbeltran
Copy link
Member

miquelbeltran commented Mar 29, 2021

Please "here it does not work" is not helpful, provide more information.

@tomasweigenast
Copy link

@miquelbeltran I ran flutter pub upgrade and device_info_plus_platform_interface 1.0.1 appeared when "Resolving dependencies". But the same error is still happening, I also did:

dependency_overrides:
  device_info_plus_platform_interface: 1.0.1

@miquelbeltran
Copy link
Member

Are you running on Android or on another platform?

@tomasweigenast
Copy link

Android, where the error happens

@miquelbeltran
Copy link
Member

Would you be able to provide a project that reproduces the issue? since I am not having the issue anymore.

I will reopen this meanwhile, in case anyone reports the same error. Please provide any new logs as well if you can.

@miquelbeltran miquelbeltran reopened this Mar 29, 2021
@tomasweigenast
Copy link

@miquelbeltran This is what I get when I run flutter pub upgrade

Resolving dependencies...
  async 2.5.0
  boolean_selector 2.1.0
  characters 1.1.0
  charcode 1.2.0
  clock 1.1.0
  collection 1.15.0
  device_info_plus 1.0.0
  device_info_plus_linux 1.0.0
  device_info_plus_macos 1.0.0
  device_info_plus_platform_interface 1.0.1
  device_info_plus_web 1.0.0
  device_info_plus_windows 1.0.0
  fake_async 1.2.0
  ffi 1.0.0
  file 6.1.0
  file_utils 1.0.0
  firebase_core 1.0.2
  firebase_core_platform_interface 4.0.0
  firebase_core_web 1.0.2
  firebase_crashlytics 1.0.0
  firebase_crashlytics_platform_interface 2.0.0
  flutter 0.0.0 from sdk flutter
  flutter_test 0.0.0 from sdk flutter
  flutter_web_plugins 0.0.0 from sdk flutter
  get_it 6.0.0
  globbing 1.0.0
  intl 0.17.0
  js 0.6.3
  matcher 0.12.10
  meta 1.3.0
  path 1.8.0
  plugin_platform_interface 2.0.0
  sky_engine 0.0.99 from sdk flutter
  source_span 1.8.0 (1.8.1 available)
  stack_trace 1.10.0
  stream_channel 2.1.0
  string_scanner 1.1.0
  system_info 1.0.0
  term_glyph 1.2.0
  test_api 0.2.19 (0.3.0 available)
  typed_data 1.3.0
  vector_math 2.1.0
  win32 2.0.5
No dependencies changed.
2 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

@tomasweigenast
Copy link

@miquelbeltran You can download the following repository: https://github.com/TomasWeg/dram and run the example

@miquelbeltran
Copy link
Member

@TomasWeg I don't see any error logs related to this issue, only a blank screen and the following logs:

 flutter run        
Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on sdk gphone x86 in debug mode...
Note: /home/miquel/.pub-cache/hosted/pub.dartlang.org/device_info_plus-1.0.0/android/src/main/java/dev/fluttercommunity/plus/device_info/DeviceInfoPlusPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                    
Note: /home/miquel/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.0.2/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                    
Note: /home/miquel/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-1.0.0/android/src/main/java/io/flutter/plugins/firebase/crashlytics/FlutterFirebaseCrashlyticsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                    
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        43.7s
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...                475ms
E/flutter (18007): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Exception: Logger not initialized yet. Use Logger().
E/flutter (18007): #0      Logger._log (package:dram/src/logger/base/logger.dart:63:7)
E/flutter (18007): #1      Logger.debug (package:dram/src/logger/base/logger.dart:43:5)
E/flutter (18007): #2      Application.init (package:dram/src/app/application.dart:31:12)
E/flutter (18007): #3      runApplication (package:dram/app.dart:22:21)
E/flutter (18007): <asynchronous suspension>
E/flutter (18007): #4      main (package:dram_example/main.dart:7:3)
E/flutter (18007): <asynchronous suspension>
E/flutter (18007): 
Syncing files to device sdk gphone x86...                           76ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:44709/ovOS8bdXUEo=/

Flutter DevTools, a Flutter debugger and profiler, on sdk gphone x86 is available at: http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A44709%2FovOS8bdXUEo%3D%2F

💪 Running with sound null safety 💪
I/flutter (15546): 15:00:08.565 [DEBUG]   [PusherWrapper.init.<fn>] - Pusher State: RECONNECTING
I/flutter (15546): 15:00:08.567 [ERROR]   [PusherWrapper.init.<fn>] - Pusher Error. Code: null - An exception was thrown by the websocket
I/flutter (15546): 15:00:09.605 [DEBUG]   [PusherWrapper.init.<fn>] - Pusher State: CONNECTING
I/flutter (15546): 15:00:09.605 [ERROR]   [PusherWrapper.init.<fn>] - Pusher Error. Code: null - An exception was thrown by the websocket
I/flutter (15546): 15:00:10.138 [DEBUG]   [PusherWrapper.init.<fn>] - Pusher State: CONNECTED
I/flutter (15546): 15:00:10.139 [ERROR]   [PusherWrapper.init.<fn>] - Pusher Error. Code: null - An exception was thrown by the websocket

I am not sure how can I help here, please provide more logs or an example than reproduces the issue.

@tomasweigenast
Copy link

@miquelbeltran I don't know why you get that error, because it should not happen because Logger is initialized. I tried again the error continue happening

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants