Skip to content
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

[Bug]: symbol: class NonNull #386

Open
2 of 3 tasks
Aqitaniya opened this issue Feb 7, 2025 · 1 comment
Open
2 of 3 tasks

[Bug]: symbol: class NonNull #386

Aqitaniya opened this issue Feb 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Aqitaniya
Copy link

Required Reading

  • Confirmed

Plugin Version

1.3.7

Flutter Doctor

/flutter/bin/flutter doctor --verbose
[!] Flutter (Channel stable, 3.27.4, on macOS 15.1.1 24B91 darwin-arm64, locale en-GB)
    • Flutter version 3.27.4 on channel stable at /flutter
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/3.5.4/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /flutter. Consider adding /flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d8a9f9a52e (7 days ago), 2025-01-31 16:07:18 -0500
    • Engine revision 82bd5b7209
    • Dart version 3.6.2
    • DevTools version 2.40.3
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME = /Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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-17.0.6b829.9-10027231)

[✓] Connected device (5 available)
    • Redmi 6A (mobile)               • 0867a84f7d2b              • android-arm    • Android 8.1.0 (API 27)
    • Aquitania (mobile)              • 00008110-000115011E78801E • ios            • iOS 18.3 22D63
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 15.1.1 24B91 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 15.1.1 24B91 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 132.0.6834.160
    ! Error: Browsing on the local area network for iPhone Alex. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Apple Watch — Oleksandr. Ensure the device is unlocked and discoverable via Bluetooth. (code -27)
    ! Error: Browsing on the local area network for iPhone (Вадим). Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

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

! Doctor found issues in 1 category.

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

no

Device operating-systems(s)

no

What happened?

After update to Kotlin 2.1.10 I have get such errors when try create build for Android:

/.pub-cache/hosted/pub.dev/background_fetch-1.3.7/android/src/main/java/com/transistorsoft/flutter/backgroundfetch/HeadlessTask.java:8: error: cannot find symbol
import androidx.annotation.Keep;
^
symbol: class Keep
location: package androidx.annotation
/.pub-cache/hosted/pub.dev/background_fetch-1.3.7/android/src/main/java/com/transistorsoft/flutter/backgroundfetch/HeadlessTask.java:9: error: cannot find symbol
import androidx.annotation.NonNull;
^
symbol: class NonNull
location: package androidx.annotation
/.pub-cache/hosted/pub.dev/background_fetch-1.3.7/android/src/main/java/com/transistorsoft/flutter/backgroundfetch/HeadlessTask.java:11: error: package com.transistorsoft.tsbackgroundfetch does not exist
import com.transistorsoft.tsbackgroundfetch.BGTask;
^
/.pub-cache/hosted/pub.dev/background_fetch-1.3.7/android/src/main/java/com/transistorsoft/flutter/backgroundfetch/HeadlessTask.java:12: error: package com.transistorsoft.tsbackgroundfetch does not exist
import com.transistorsoft.tsbackgroundfetch.BackgroundFetch;
^
/.pub-cache/hosted/pub.dev/background_fetch-1.3.7/android/src/main/java/com/transistorsoft/flutter/backgroundfetch/HeadlessTask.java:21: error: package io.flutter.embedding.engine does not exist
import io.flutter.embedding.engine.FlutterEngine;

Plugin Code and/or Config

Future<void> configureScheduleTask() async {
    final int status = await BackgroundFetch.configure(BackgroundFetchConfig(
        minimumFetchInterval: 15,
        forceAlarmManager: true,
        stopOnTerminate: false,
        startOnBoot: true,
        enableHeadless: true,
        requiresBatteryNotLow: false,
        requiresCharging: false,
        requiresStorageNotLow: false,
        requiresDeviceIdle: false,
        requiredNetworkType: NetworkType.NONE
    ), _onBackgroundFetch, _onBackgroundFetchTimeout);
    print('[BackgroundFetch] configure success: $status');
  }

@pragma('vm:entry-point')
void backgroundFetchHeadlessTask(HeadlessTask task) async {
      var taskId = task.taskId;
      var timeout = task.timeout;
      if (timeout) {
            print("[BackgroundFetch] Headless task timed-out: $taskId");
            BackgroundFetch.finish(taskId);
            return;
      }
      print("[BackgroundFetch] Headless event received: $taskId");
      final job = HelperJobs();
      if (taskId == 'flutter_background_fetch') {
            job.initJob();
      }
      BackgroundFetch.finish(taskId);
}

Relevant log output

@Aqitaniya Aqitaniya added the bug Something isn't working label Feb 7, 2025
@christocracy
Copy link
Member

This is most likely an issue with your own app's gradle config.

My plugin does not use Kotlin at all.

Googling, I found this: https://stackoverflow.com/questions/76374809/android-studio-cannot-resolve-symbol-nonnull-import-androidx-annotation-nonn

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

2 participants