Skip to content
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

subscribeConnectionStatus on Android release build crashes due to null safety #129

Closed
sidak003 opened this issue Aug 9, 2021 · 11 comments · Fixed by #146
Closed

subscribeConnectionStatus on Android release build crashes due to null safety #129

sidak003 opened this issue Aug 9, 2021 · 11 comments · Fixed by #146
Labels
android Specific for android awaiting-clarification clarification or retesting needed bug Something isn't working

Comments

@sidak003
Copy link

sidak003 commented Aug 9, 2021

Describe the bug
subscribeConnectionStatus does not work or crashes due to null safety on Android Release Build but in debug mode works properly. I am currently on version 2.1.0 ~latest and here is the log when it crashes due to null safety:

E/flutter ( 8658): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: type 'Null' is not a subtype of type 'bool' in type cast
E/flutter ( 8658): #0      _$ConnectionStatusFromJson (package:spotify_sdk/models/connection_status.g.dart:16)
E/flutter ( 8658): #1      new ConnectionStatus.fromJson (package:spotify_sdk/models/connection_status.dart:29)
E/flutter ( 8658): #2      SpotifySdk.subscribeConnectionStatus.<anonymous closure> (package:spotify_sdk/spotify_sdk.dart:324)
E/flutter ( 8658): #3      Stream.asyncMap.<anonymous closure>.<anonymous closure> (dart:async/stream.dart:554)
E/flutter ( 8658): #4      _rootRunUnary (dart:async/zone.dart:1362)
E/flutter ( 8658): #5      _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter ( 8658): #6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170)
E/flutter ( 8658): #7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
E/flutter ( 8658): #8      _DelayedData.perform (dart:async/stream_impl.dart:591)
E/flutter ( 8658): #9      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706)
E/flutter ( 8658): #10     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663)
E/flutter ( 8658): #11     _rootRun (dart:async/zone.dart:1346)
E/flutter ( 8658): #12     _CustomZone.run (dart:async/zone.dart:1258)
E/flutter ( 8658): #13     _CustomZone.runGuarded (dart:async/zone.dart:1162)
E/flutter ( 8658): #14     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202)
E/flutter ( 8658): #15     _rootRun (dart:async/zone.dart:1354)
E/flutter ( 8658): #16     _CustomZone.run (dart:async/zone.dart:1258)
E/flutter ( 8658): #17     _CustomZone.runGuarded (dart:async/zone.dart:1162)
E/flutter ( 8658): #18     _CustomZone.bindCallbackGuarded.<anonymous closure> `(dart:async/zone.dart:1202

NOTE: I have already checked #91 but couldn't found a fix

To Reproduce
Steps to reproduce the behavior:

  1. Just call SpotifySdk.subscribeConnectionStatus()
  2. Run the build in release mode

Expected behavior
Error due to Null Safety or nothing happens

Desktop (please complete the following information):

  • OS: [Windows 10]
  • Version [20H2]

Smartphone (please complete the following information):

  • Device: [Redmi 5 Plus]
  • OS: [Android]
  • Version [10]
@sidak003
Copy link
Author

Hey @brim-borium sorry to disturb, may you have a view at this issue

@fotiDim fotiDim added the android Specific for android label Oct 1, 2021
@fotiDim
Copy link
Collaborator

fotiDim commented Oct 2, 2021

@Sidak100 can you reproduce the same issue with the example app and the latest version from the main branch? Are you sure that you configured your project correctly? I was not able to reproduce it.

@fotiDim fotiDim added the awaiting-clarification clarification or retesting needed label Oct 2, 2021
@sidak003
Copy link
Author

sidak003 commented Oct 2, 2021

@Sidak100 can you reproduce the same issue with the example app and the latest version from the main branch? Are you sure that you configured your project correctly? I was not able to reproduce it.

Yes I tried the same with example app, still same issue. Regarding configuring I tried method provided in #99

@fotiDim
Copy link
Collaborator

fotiDim commented Oct 2, 2021

@Sidak100 how are you building the app? In release mode no logs are printed. Can you please describe in detail the steps you do?

@fotiDim fotiDim added the bug Something isn't working label Oct 3, 2021
@sidak003
Copy link
Author

sidak003 commented Oct 6, 2021

@Sidak100 how are you building the app? In release mode no logs are printed. Can you please describe in detail the steps you do?

The app working is simple, it subscribes to connection status and when connection is sucess or gets true it does certain things like bring the user data ~same as example app.
Actually in release mode when I connect to spotify using remote, it gets the connection object as null which is supposed to be a boolean, this gives the log error as in 1st comment. Although it is connected to spotify I can play pause tracks but can't get status.
In debug mode works fine no error no log.

@alanhmartins
Copy link

The same thing happens to me. Managed to solve?

@sidak003
Copy link
Author

The same thing happens to me. Managed to solve?

Try these commands for release build

flutter build apk --no-shrink

or

flutter build apk --split-per-abi --no-shrink

Although I didn't tried since I am out of home but let me know immediately if it works 👊🏻

@alanhmartins
Copy link

it didn't work

Sorry for the delay, but I'm in a different time zone, I'm in Brazil.

@brim-borium brim-borium linked a pull request Nov 27, 2021 that will close this issue
@brim-borium
Copy link
Owner

@alanhmartins found the issue:

Because of obfuscating on the android side on release branches, some model keys had been renamed during the release build and that lead to a problem during decoding of the returning jsons

Should be fixed with #146

@sidak003
Copy link
Author

@alanhmartins found the issue:

Because of obfuscating on the android side on release branches, some model keys had been renamed during the release build and that lead to a problem during decoding of the returning jsons

Should be fixed with #146

Thanks a lot buddy 👊🏻

@brim-borium
Copy link
Owner

@Sidak100 @alanhmartins
Just released v2.2.0 of the package, feel free to test if everything still works for you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Specific for android awaiting-clarification clarification or retesting needed bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants