Skip to content

[flutter_foreground_service ^0.4.1] Build Failure Due to Kotlin Compilation Errors #1199

Open
@leandroveronezi

Description

@leandroveronezi

Plugin Name

flutter_foreground_service

Plugin Version

^0.4.1

Device

android

Operating System

any

Describe the bug

flutter_foreground_service plugin fails to compile when using latest version of Flutter

Steps to Reproduce

flutter build apk --debug

Expected Behavior

The plugin should compile and work without issues in both debug and release mode using the latest stable version of Flutter.

Actual Behavior

Build fails with multiple Kotlin compilation errors:

e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:15:44 Unresolved reference 'shim'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:19:48 Unresolved reference 'Registrar'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:21:24 Unresolved reference 'FlutterMain'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:70:33 Unresolved reference 'Registrar'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:72:45 Unresolved reference 'context'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:72:66 Unresolved reference 'messenger'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:121:51 Unresolved reference 'PluginRegistrantCallback'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:128:65 Unresolved reference 'PluginRegistrantCallback'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:377:5 Unresolved reference 'FlutterMain'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:383:23 Unresolved reference 'FlutterMain'.

Flutter Logs

flutter build apk --debug

Support for Android x86 targets will be removed in the next stable release after 3.27. See
https://github.com/flutter/flutter/issues/157543 for details.
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /home/leandro/.pub-cache/hosted/pub.dev/google_mlkit_commons-0.11.0/android/src/main/java/com/google_mlkit_commons/InputImageConverter.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:15:44 Unresolved reference 'shim'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:19:48 Unresolved reference 'Registrar'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:21:24 Unresolved reference 'FlutterMain'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:70:33 Unresolved reference 'Registrar'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:72:45 Unresolved reference 'context'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:72:66 Unresolved reference 'messenger'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:121:51 Unresolved reference 'PluginRegistrantCallback'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:128:65 Unresolved reference 'PluginRegistrantCallback'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:377:5 Unresolved reference 'FlutterMain'.
e: file:///home/leandro/.pub-cache/hosted/pub.dev/flutter_foreground_service-0.4.1/android/src/main/kotlin/dk/cachet/flutter_foreground_service/FlutterForegroundServicePlugin.kt:383:23 Unresolved reference 'FlutterMain'.

Screenshots

No response

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.29.3, on openSUSE Leap 15.4 5.14.21-150400.24.100-default, locale pt_BR.UTF-8) [196ms]
    • Flutter version 3.29.3 on channel stable at /home/leandro/development/flutter
    • Upstream repository [email protected]:flutter/flutter.git
    • Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000
    • Engine revision cf56914b32
    • Dart version 3.7.2
    • DevTools version 2.42.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [4,7s]
    • Android SDK at /home/leandro/Android/Sdk
    • Platform android-35, build-tools 35.0.1
    • ANDROID_HOME = /home/leandro/Android/Sdk
    • Java binary at: /home/leandro/Programas/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.5+-13047016-b750.29)
    • All Android licenses accepted.

[✓] Chrome - develop for the web [114ms]
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop [572ms]
    • clang version 13.0.1
    • cmake version 3.20.4
    • ninja version 1.10.0
    • pkg-config version 0.29.2

[✓] Android Studio (version 2024.2) [112ms]
    • Android Studio at /home/leandro/Programas/android-studio
    • Flutter plugin version 83.0.4
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)

[✓] VS Code (version 1.99.3) [13ms]
    • VS Code at /usr/share/code
    • Flutter extension version 3.110.0

[✓] Connected device (2 available) [470ms]
    • Linux (desktop) • linux  • linux-x64      • openSUSE Leap 15.4 5.14.21-150400.24.100-default
    • Chrome (web)    • chrome • web-javascript • Google Chrome 136.0.7103.92

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

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions