Skip to content

🐞Cannot build app using this package #586

Closed
@Mihai-B

Description

@Mihai-B
  • 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

0.5.2

Technology Version
Workmanager version 0.5.2

Describe the error
If I add this package to my pubspec.yml, I get this error:

Running Gradle task 'assembleDebug'...
e: file:///home/mike/.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:///home/mike/.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:///home/mike/.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:///home/mike/.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:///home/mike/.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:///home/mike/.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:///home/mike/.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:///home/mike/.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:///home/mike/.pub-cache/hosted/pub.dev/workmanager-0.5.2/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt:49:80 Unresolved reference 'PluginRegistrantCallback'.

Output of flutter doctor -v

[✓] Flutter (Channel beta, 3.28.0-0.1.pre, on Arch Linux 6.12.9-arch1-1, locale en_US.UTF-8)
    • Flutter version 3.28.0-0.1.pre on channel beta at -/SDKs/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3e493a3e4d (5 weeks ago), 2024-12-12 05:59:24 +0900
    • Engine revision 2ba456fd7f
    • Dart version 3.7.0 (build 3.7.0-209.1.beta)
    • DevTools version 2.41.0

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at -/android
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = -
    • Java binary at: -/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 21.0.4+-12422083-b607.1)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = -/bin/google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 19.1.6
    • cmake version 3.31.4
    • ninja version 1.12.1
    • pkg-config version 2.3.0

[✓] Android Studio (version 2024.2)
    • Android Studio at -/android-studio
    • Flutter plugin version 83.0.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)

[✓] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • Linux (desktop)              • linux         • linux-x64      • Arch Linux 6.12.9-arch1-1
    • Chrome (web)                 • chrome        • web-javascript • Chromium 131.0.6778.264

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

R0ya1Eag1e

R0ya1Eag1e commented on Jan 18, 2025

@R0ya1Eag1e

have same error

R0ya1Eag1e

R0ya1Eag1e commented on Jan 19, 2025

@R0ya1Eag1e

temporarily fixed this, opened BackgroundWorker.kt and WorkmanagerPlugin.kt in \AppData\Local\Pub\Cache\hosted\pub.dev\workmanager-0.5.2\android\src\main\kotlin\dev\fluttercommunity\workmanager and commented this lines:
in BackgroundWorker.kt: 14 and 98
in WorkmanagerPlugin.kt: from 34 to 52

it seems like android embedding method v1 is no longer supported by flutter and this lines can be deleted

Mihai-B

Mihai-B commented on Jan 19, 2025

@Mihai-B
Author

This might be a duplicate of: #564

armandsLa

armandsLa commented on Feb 14, 2025

@armandsLa

You can add workmanager from the main branch directly, as it no longer has the v1 fallbacks.

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

Sergio-2012 commented on Apr 15, 2025

@Sergio-2012

You can add workmanager from the main branch directly, as it no longer has the v1 fallbacks.

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

This seems to work but it feels wrong to not have a pinned release version. Would opening an issue on the community repo be a bad idea. From the README.md of that repo it looks like flutter_workmanager doesn't have a maintainer. Is this correct?

https://github.com/fluttercommunity/community/issues

I'm new to flutter, I am not sure how to request a new build to pub.dev

charafau

charafau commented on May 29, 2025

@charafau
Collaborator

fixed with 0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      🐞Cannot build app using this package · Issue #586 · fluttercommunity/flutter_workmanager