Skip to content

[Workmanager] Unresolved References After Flutter 3.29.0 Update #588

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

Open
4 tasks done
naneps opened this issue Feb 13, 2025 · 35 comments
Open
4 tasks done

[Workmanager] Unresolved References After Flutter 3.29.0 Update #588

naneps opened this issue Feb 13, 2025 · 35 comments
Labels
bug Something isn't working

Comments

@naneps
Copy link

naneps commented Feb 13, 2025


Issue Report

  • I have read the README
  • I have done the setup for Android
  • I have done the setup for iOS
  • I have ran the sample app and it does not work there

Version

Technology Version
Workmanager version 0.5.2
Flutter version 3.29.0 (stable)
Xcode version (fill this if applicable)
Swift version (fill this if applicable)
iOS deployment target (fill this if applicable)

Describe the error

After updating Flutter to version 3.29.0 (stable), the sample app does not work. The following errors appear when launching the app:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
e: file:///C:/Users/DEV_Flutter/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:14:44 Unresolved reference: shim
e: file:///C:/Users/DEV_Flutter/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:68 Unresolved reference: ShimPluginRegistry
e: file:///C:/Users/DEV_Flutter/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:35:52 Unresolved reference: PluginRegistrantCallback

It seems like there are unresolved references related to shim, ShimPluginRegistry, and PluginRegistrantCallback in the Workmanager package.

Would appreciate any guidance on how to resolve this issue.

Output of flutter doctor -v

[√] Flutter (Channel stable, 3.29.0, on Microsoft Windows [Version 10.0.22631.4890], locale en-US) [410ms]
    • Flutter version 3.29.0 on channel stable at C:\Users\DEV_Flutter\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (2 days ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[√] Windows Version (11 Pro 64-bit, 23H2, 2009) [1,506ms]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [1,779ms]
    • Android SDK at C:\Users\DEV_Flutter\AppData\Local\Android\sdk
    • Platform android-Baklava, build-tools 35.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
    • All Android licenses accepted.

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

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.6) [164ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34221.43
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.3) [105ms]
    • 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.10+0--11572160)

[√] IntelliJ IDEA Ultimate Edition (version 2023.3) [104ms]
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2023.3.3
    • Flutter plugin version 77.3.1
    • Dart plugin version 233.13763.5

[√] VS Code (version 1.96.4) [14ms]
    • VS Code at C:\Users\DEV_Flutter\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.104.0

[√] Connected device (4 available) [284ms]
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.4890]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 132.0.6834.160
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 133.0.3065.59

[√] Network resources [1,417ms]
    • All expected network resources are available.

• No issues found!

@naneps naneps added the bug Something isn't working label Feb 13, 2025
@shehan-n
Copy link

I'm facing the same issue in flutter 3.29.0

@large
Copy link

large commented Feb 13, 2025

Same here, even more errors when using the workmanager in a widget

/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:14:44 Unresolved reference 'shim'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:55 Unresolved reference 'registerWith'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:68 Unresolved reference 'ShimPluginRegistry'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:35:52 Unresolved reference 'PluginRegistrantCallback'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:38:52 Unresolved reference 'Registrar'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:49 Unresolved reference 'context'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:70 Unresolved reference 'messenger'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:41:23 Unresolved reference 'addViewDestroyListener'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:49:80 Unresolved reference 'PluginRegistrantCallback'.

Flutter 3.29.0 is pain, they removed support for the old v1 plugins. Rendring thousand of plugins to be forced updated.

@danyialkhan
Copy link

facing the same issue in flutter 3.29.0.

@zhushenwudi
Copy link

Does anyone fork and upgrade this repo to the v2 plugin version?

@waffiqaziz
Copy link

Same issue here my running

... Unresolved reference: shim
... Unresolved reference: ShimPluginRegistry
... Unresolved reference: PluginRegistrantCallback
... Unresolved reference: Registrar
... Unresolved reference: PluginRegistrantCallback

... Execution failed for task ':workmanager:compileDebugKotlin'.

Before the new flutter it was okay here

@Muslimdeveloper1444
Copy link

facing the same issue in flutter 3.29.0.

@zhushenwudi
Copy link

zhushenwudi commented Feb 15, 2025

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

@large
Copy link

large commented Feb 15, 2025

It can be solved by directly relying on this repository, and the author has replies on other issues

Thank you for this simple and clever solution.
I though they published on pub.dev when they fixed things 👍

It also fixed my androidx.work:work-runtime-ktx strictly use on 2.8.1 when combined with Glance-widget.
Good fix!

@zhushenwudi
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

Thank you for this simple and clever solution. I though they published on pub.dev when they fixed things 👍

It also fixed my androidx.work:work-runtime-ktx strictly use on 2.8.1 when combined with Glance-widget. Good fix!

Yes, I also noticed this situation and deleted the forced dependency replacement for 2.8.1

@MoSaber-hub
Copy link

MoSaber-hub commented Feb 18, 2025

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Good.. Thank you, I think it would be a good idea to update the package in https://pub.dev/packages/workmanager so more developers could know about it!.

@rahulmaindargi
Copy link

Facing same issues

with latest workmanager: ^0.5.2

e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:14:44 Unresolved reference 'shim'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:55 Unresolved reference 'registerWith'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:68 Unresolved reference 'ShimPluginRegistry'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:35:52 Unresolved reference 'PluginRegistrantCallback'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:38:52 Unresolved reference 'Registrar'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:49 Unresolved reference 'context'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:70 Unresolved reference 'messenger'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:41:23 Unresolved reference 'addViewDestroyListener'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:49:80 Unresolved reference 'PluginRegistrantCallback'.

@shehan-n
Copy link

is it fixed in repo but not released a new version?

@kunal311997
Copy link

The callbackDispatcher is not calling for me in version 3.29.0. Are others having same issue?

@efica
Copy link

efica commented Feb 21, 2025

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Best solution for now

@bqliang
Copy link

bqliang commented Feb 23, 2025

Facing same issues  面临同样的问题

with latest workmanager: ^0.5.2与最新的workmanager: ^0.5.2

e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:14:44 Unresolved reference 'shim'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:55 Unresolved reference 'registerWith'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:68 Unresolved reference 'ShimPluginRegistry'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:35:52 Unresolved reference 'PluginRegistrantCallback'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:38:52 Unresolved reference 'Registrar'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:49 Unresolved reference 'context'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:70 Unresolved reference 'messenger'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:41:23 Unresolved reference 'addViewDestroyListener'.
e: file:///C:/Users/rahul/AppData/Local/Pub/Cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:49:80 Unresolved reference 'PluginRegistrantCallback'.

Same here

@aliasgar4558
Copy link

++Faced - Let us know once it gets resolved & new version is available with the fix please.

@Eyosi-G
Copy link

Eyosi-G commented Feb 24, 2025

Same here, even more errors when using the workmanager in a widget

/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:14:44 Unresolved reference 'shim'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:55 Unresolved reference 'registerWith'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:98:68 Unresolved reference 'ShimPluginRegistry'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:35:52 Unresolved reference 'PluginRegistrantCallback'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:38:52 Unresolved reference 'Registrar'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:49 Unresolved reference 'context'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:40:70 Unresolved reference 'messenger'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:41:23 Unresolved reference 'addViewDestroyListener'.
/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:49:80 Unresolved reference 'PluginRegistrantCallback'.

Flutter 3.29.0 is pain, they removed support for the old v1 plugins. Rendring thousand of plugins to be forced updated.

The simplest task of running flutter default app worked after 3 days of configuration, reinstalling but now I'm facing the same issue.

@wantroba
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Worked for me. Waiting for the release of the new version...

@FaFre
Copy link

FaFre commented Mar 4, 2025

@ened @charafau please push a release to pub.dev, this is urgently needed!

@salarazad
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Thank you, this solved the issue, but it would be great to release this update on pub.dev as well.

@Prahlad-Shaktawat
Copy link

I'm facing the same issue in flutter 3.29.1

@geovaniprodata
Copy link

Image

  • Flutter version: 3.29.1
  • Dart version: 3.7.0

After upgrade.

@thisisprabhat
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Thanks, It got fixed

@Sesa1988
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Yes, probably, but what's the point? Everyone is using pub.dev for their packages, so why isn't a release happening?

@BigYajuu
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Worked for me. Waiting for the release of the new version...

Yes this solution has gotten me around the Unresolved reference issue, but now my delayed periodic task just don't run callbackDispatcher() anymore. Anyone knows why??

For details, my Workmanager().registerPeriodicTask runs and seems to be registering (I have no idea but I guess it does), but the callback won't run.

@geovaniprodata
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Worked for me. Waiting for the release of the new version...

Yes this solution has gotten me around the Unresolved reference issue, but now my delayed periodic task just don't run callbackDispatcher() anymore. Anyone knows why??

For details, my Workmanager().registerPeriodicTask runs and seems to be registering (I have no idea but I guess it does), but the callback won't run.

Did you put

@pragma('vm:entry-point')

above the void callbackDispatcher() ?

@BigYajuu
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Worked for me. Waiting for the release of the new version...

Yes this solution has gotten me around the Unresolved reference issue, but now my delayed periodic task just don't run callbackDispatcher() anymore. Anyone knows why??
For details, my Workmanager().registerPeriodicTask runs and seems to be registering (I have no idea but I guess it does), but the callback won't run.

Did you put

@pragma('vm:entry-point')

above the void callbackDispatcher() ?

I have. Everything is in order because the callback does get invoked every now and then.

The problem is how inconsistent it is especially when it comes to periodic tasks back then. Even worse is now when I changed my pubspec, callback just won't run at all, lol, even when I set initialDelay to 1 second.

@BigYajuu
Copy link

BigYajuu commented Mar 21, 2025

I hope yall didnt take my last post as "problem solved", in fact it's the exact opposite. Upon further testing I realized that initDelay in registerPeriodicTask is completely useless. I used 3 different initDelay values - 2 min, 5 min and 7 min, and frequency value just 15 min, and the first notification always gets pushed after the frequency duration (15 min), not initDelay duration. Subsequent notifications do show up in correct frequency.

And you gotta know that this used to work before I changed my pubspec to main branch. I will raise an issue about this shortly.

@zhushenwudi
Copy link

The minimum cycle for android workmanager has always been 15 minutes

@BigYajuu
Copy link

The minimum cycle for android workmanager has always been 15 minutes

I'm speaking of initDelay. I don't think it has anything to do with minimum cycle of periodic tasks.

But whether or not it's relevant, I'm sure that initDelay used to work perfectly before.

@zhushenwudi
Copy link

The minimum cycle for android workmanager has always been 15 minutes

I'm speaking of initDelay. I don't think it has anything to do with minimum cycle of periodic tasks.

But whether or not it's relevant, I'm sure that initDelay used to work perfectly before.

I have used the previous version before, but it still takes at least 15 minutes to trigger, So my expectations for this library are not very high

@Manuito83
Copy link

I have used the previous version before, but it still takes at least 15 minutes to trigger, So my expectations for this library are not very high

The previous version did work (and allowed the time between updates to be lower than 15 minutes) by using exactly the same combination of several initialDelay for tasks that can be used in native Android.

The new version does not seem to work because the native WorkManager was updated. See my reply here: #594 (comment)

Whether this is something that has been changed in (native) Android or something that needs to be updated in this package when using a WorkManager higher than v2.7.1, that I don't know.

@iotmehedi
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

simple but best solution

@Sesa1988
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

simple but best solution

Is there a reason why it hasn't been released on pub.dev?

@aldisa546
Copy link

It can be solved by directly relying on this repository, and the author has replies on other issues

workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      path: workmanager
      ref: main

Worked for me. Waiting for the release of the new version...

Yes this solution has gotten me around the Unresolved reference issue, but now my delayed periodic task just don't run callbackDispatcher() anymore. Anyone knows why??

For details, my Workmanager().registerPeriodicTask runs and seems to be registering (I have no idea but I guess it does), but the callback won't run.

Had the same issue. For a temporary solution, I've forked the repository starting from this commit: b783000 to make it compatible with Flutter 3.29 (mine was tested on 3.29.3).

workmanager:
    git:
      url: https://github.com/aldisa546/flutter_workmanager.git
      ref: upgrade/flutter-3.29

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

No branches or pull requests