fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.
826 stars 247 forks source link

🐞[Android] namenotfoundexception from example app #495

Closed milindgoel15 closed 9 months ago

milindgoel15 commented 11 months ago

Version

Technology Version
Workmanager version 0.5.1
Xcode version na
Swift version na
iOS deployment target na

Describe the error Ever since i installed the example app and tried the work manager plugin, you get this log every few minutes on your device after uninstalling the app. I am not sure why its trying to find the app but one guess would be a task that was scheduled using such app is trying to get called but cant find the app to execute it.

android.content.pm.PackageManager$NameNotFoundException: dev.fluttercommunity.workmanager.example

Does the job not get cancelled or deleted automatically if the app gets uninstalled?

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.22621.1992], locale en-IN)
    • Flutter version 3.10.6 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (3 weeks ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\Lenovo\AppData\Local\Android\Sdk
    • Platform android-33-ext4, build-tools 33.0.1
    • ANDROID_SDK_ROOT = C:\Users\Lenovo\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[✓] Android Studio (version 2022.3)
    • 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 17.0.6+0-b2043.56-10027231)

[✓] VS Code, 64-bit edition (version 1.80.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.66.0

[!] Connected device
    ! No devices available

[✓] Network resources
    • All expected network resources are available.
milindgoel15 commented 11 months ago

Update: installed the example app again and cancelled all tasks using the app. After uninstalling the app again, the namenotfoundexception seems to be gone.

So could something be done that if the app gets uninstalled, all the tasks that were scheduled using such app gets cancelled automatically?

Update2: there seem to be a different kind of log now

PFTBT
Requested package dev.fluttercommunity.workmanager.example not found; ignoring
ened commented 9 months ago

Quite interesting, but this seems to be an Android quirk. Uninstalling a App must remove all of it's traces, including scheduled background jobs.

The next version will be based on Workmanager 1.8.1 - we can try again then, but this surely looks like a platform issue.