Git Product home page Git Product logo

Comments (9)

ryanheise avatar ryanheise commented on June 3, 2024

Minimal reproduction project

Official example: main.dart < -----

Reproduction steps

It's a runtime issue for some users. We don't have the reproduction steps.

It's highly unlikely that you are actually running my example in production and it has users.

It is more likely that you just didn't bother to create the minimal reproduction project and provide the reproduction steps. Without that, it's impossible to determine exactly which line the issue happens on, and it is also impossible to tell whether this is a bug within the plugin or a bug within your app.

I'll close this as an invalid issue, but please open a new bug report and provide answers to the questions missing from your current report.

from audio_service.

musaffa avatar musaffa commented on June 3, 2024

@ryanheise Sorry for the confusion. We certainly are not running your example in Production. We have a production app with 200k Android users and 20% is facing this issue.

This issue doesn't happen in Android simulator and the Android devices we use for testing. That's why I didn't create any minimal reproduction project and I couldn't provide you the reproduction steps.

My hope was that since we can pin point the line where the exception occurs, you, the author of this plugin, might know why audioHandlerInterface is null for some users.

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

Is it possible for you to at least share your pubspec dependencies and mention anything non-standard that your app might be doing in configuration?

I have added a null check in branch fix/notification_npe. Is there any way you could test whether this solves your issue?

from audio_service.

musaffa avatar musaffa commented on June 3, 2024

audioHandlerInterface is initialized at onAttachedToEngine and removed at onDetachedFromEngine. Is there any chance that onAttachedToActivity might be called before onAttachedToEngine or after onDetachedFromEngine is called?

I have added a null check in branch fix/notification_npe. Is there any way you could test whether this solves your issue?

I'll try

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

audioHandlerInterface is initialized at onAttachedToEngine and removed at onDetachedFromEngine. Is there any chance that onAttachedToActivity might be called before onAttachedToEngine or after onDetachedFromEngine is called?

That's unlikely, I doubt Flutter would be calling these lifecycle methods out of order. Without a minimal reproduction project, or even a list of dependencies or information on configuration, I won't be able to investigate what code path lead to this. We can only test whether the NPE guard solves it.

from audio_service.

musaffa avatar musaffa commented on June 3, 2024

pubspec.yaml

name: my_app
description: Native App

publish_to: 'none'

version: 5.0.18+113

environment:
  sdk: '>=3.0.0 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

  # application
  flutter_dotenv: ^5.0.2

  # state management
  flutter_riverpod: ^2.3.10

  # routing
  qlevar_router: ^1.7.1

  # data
  flutter_data: ^1.5.13
  flutter_data_json_api_adapter: ^0.8.0
  isar: ^3.0.5
  isar_flutter_libs: ^3.0.5
  equatable: ^2.0.5

  # local db
  drift: ^2.10.0
  sqlite3_flutter_libs: ^0.5.13
  json_api: ^5.3.0

  # form
  date_field: ^3.0.2
  dropdown_button2: ^2.3.9
  idkit_inputformatters: ^0.0.1
  easy_debounce: ^2.0.3

  # widgets
  infinite_scroll_pagination: ^4.0.0
  scrollable_positioned_list: ^0.3.8
  carousel_slider: ^4.1.1
  animated_toggle_switch: ^0.8.0
  just_audio: ^0.9.36
  just_audio_background: ^0.0.1-beta.11
  pdfx: 2.4.0
  # pdfx:
  #   path: /home/musaffa/projects/libraries/packages.flutter/packages/pdfx

  # text
  intl: ^0.18.0
  flutter_localizations:
    sdk: flutter
  flutter_html: '^3.0.0-beta.2'
  inflection3: ^0.5.3+2
  recase: ^4.1.0
  html: ^0.15.2

  # platform
  permission_handler: ^10.2.0
  path_provider: ^2.0.12
  shared_preferences: ^2.0.16
  geolocator: ^10.0.0
  geocoding: ^2.1.0
  connectivity_plus: ^3.0.3
  open_filex: ^4.3.2
  share_plus: ^7.2.2
  wakelock_plus: ^1.1.4

  # http
  dio: ^5.3.2
  url_launcher: ^6.1.14

  # builder
  json_annotation: ^4.7.0

  # utility
  path: '^1.8.3'
  glob: ^2.1.2

  # extensions
  collection: ^1.16.0

  # islamic
  hijri: ^3.0.0
  hijri_picker:
    git:
      url: https://github.com/musaffa/hijri_picker.git
      ref: pass-weekday-number
  adhan: ^2.0.0-nullsafety.2
  smooth_compass: ^2.0.12

  # app widget
  home_widget: ^0.3.0
  workmanager: ^0.5.1

  # firebase
  firebase_core: ^2.15.0
  firebase_messaging: ^14.6.5
  flutter_local_notifications: ^15.1.0+1
  firebase_analytics: ^10.4.4
  firebase_crashlytics: ^3.3.4

  # assets
  flutter_svg: ^2.0.7
  cached_network_image: ^3.2.3
  transparent_image: ^2.0.0
  flutter_native_splash: ^2.3.2

dependency_overrides:
  audio_service:
     git:
       url: https://github.com/ryanheise/audio_service.git
       ref: fix/notification_npe
       path: audio_service

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

  build_runner: ^2.4.6
  isar_generator: ^3.0.5

  json_serializable: ^6.3.1
  faker: ^2.0.0
  drift_dev: ^2.10.0

  flutter_launcher_icons: "^0.13.1"

flutter:
  generate: true
  uses-material-design: true

  assets:
    - .env
 

  fonts:
    - family: Roboto
      fonts:
        - asset: assets/fonts/Roboto-Regular.ttf
        - asset: assets/fonts/Roboto-Bold.ttf
          weight: 700

flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: assets/images/logos/logo-icon.png

flutter_native_splash:
  color: "#0a676a"
  image: assets/images/logos/logo-transparent.png
  web: false

  android_12:
    image: assets/images/logos/logo-transparent-android-12.png

from audio_service.

musaffa avatar musaffa commented on June 3, 2024

@ryanheise Can you please open #1051 issue temporarily?

from audio_service.

ryanheise avatar ryanheise commented on June 3, 2024

Regarding your dependencies, it may be possible that geolocator and/or some of the firebase plugins could be interacting in the background with the way that audio_service works, since those plugins also interact with the FlutterEngine lifecycle.

The ideal thing would be to have a minimal reproduction project to fully understand what is happening. My guess is that the lifecycle might be quickly started and stopped in such a short span of time that the callbacks end up running after things have detached. E.g. if one of the other plugins momentarily woke up the app in the background to receive a message and then quickly shut down again.

The null checks would help with that.

Regarding #1051 , the situation is probably the same. I have added a null check in case of any extremely short-lived FlutterEngine lifecycle (same branch).

from audio_service.

github-actions avatar github-actions commented on June 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.

from audio_service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.