rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
287 stars 321 forks source link

location_callback_handler.dart not found when run release project #348

Open ARoSistemas opened 1 year ago

ARoSistemas commented 1 year ago

Upgrade my proyect to:

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Versi¢n 10.0.22000.978], locale es-MX) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6) [√] Android Studio (version 2021.2) [√] VS Code (version 1.69.2) [√] Connected device (4 available) [√] HTTP Host Availability

and plugin not works!

debug console::

Launching lib\main.dart on SM A225M in debug mode... e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (25, 1): Class 'BackgroundLocatorPlugin' is not abstract and does not implement abstract member public abstract fun onNewIntent(p0: Intent): Boolean defined in io.flutter.plugin.common.PluginRegistry.NewIntentListener e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (215, 43): Type mismatch: inferred type is Map<Any, Any>? but Map<Any, Any> was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (215, 48): Type mismatch: inferred type is Map<Any, Any>? but Map<Any, Any> was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (224, 43): Type mismatch: inferred type is Map<Any, Any>? but Map<Any, Any> was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (224, 48): Type mismatch: inferred type is Map<Any, Any>? but Map<Any, Any> was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (243, 43): Type mismatch: inferred type is Map<Any, Any>? but Map<Any, Any> was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (243, 48): Type mismatch: inferred type is Map<Any, Any>? but Map<Any, Any> was expected

e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (266, 5): 'onNewIntent' overrides nothing e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\BackgroundLocatorPlugin.kt: (275, 35): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\IsolateHolderExtension.kt: (42, 27): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected

e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\IsolateHolderService.kt: (269, 35): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\pluggables\DisposePluggable.kt: (17, 51): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected e: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\src\main\kotlin\rekab\app\background_locator\pluggables\InitPluggable.kt: (22, 55): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected

FAILURE: Build failed with an exception.

BUILD FAILED in 8s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

so, searching looking for, I found ::

https://github.com/imsamgarg/background_locator

And add to pubspec.yml

background_locator: git: url: https://github.com/imsamgarg/background_locator ref: master

And works only on debug mode !!!

when I run flutter on console ::

flutter run --release

the plugin not works again!!!!!

errors ::

E/flutter (11228): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:myprojectone/repository/location_callback_handler.dart' not found.

jesussmile commented 1 year ago

yes same issue any fix..? this is after the recent updates on flutter side

jesussmile commented 1 year ago

@ARoSistemas can you post your pubspec.yaml

ARoSistemas commented 1 year ago

Resolved!!!!!

1.- flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Versi¢n 10.0.22000.978], locale es-MX) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6) [√] Android Studio (version 2021.2) [√] VS Code (version 1.69.2) [√] Connected device (6 available) [√] HTTP Host Availability

2.- In Pubspec.yml add this

   **background_locator_2: ^2.0.5**

  the version 1 to backgroud locator **not works on Flutter 3**

Remember :: The version of Dart is 3.0.2 only.

I test with version 3.3.2 and NOT WORKS

@jesussmile check it, and comments your results

jesussmile commented 1 year ago

Resolved!!!!!

1.- flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Versi¢n 10.0.22000.978], locale es-MX) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.6) [√] Android Studio (version 2021.2) [√] VS Code (version 1.69.2) [√] Connected device (6 available) [√] HTTP Host Availability

2.- In Pubspec.yml add this

   **background_locator_2: ^2.0.5**

  the version 1 to backgroud locator **not works on Flutter 3**

Remember :: The version of Dart is 3.0.2 only.

I test with version 3.3.2 and NOT WORKS

@jesussmile check it, and comments your results

Thanx works fine .

pnthari commented 1 year ago

Add @pragma('vm:entry-point') in location_callback_handler.dart file

@pragma('vm:entry-point')
static Future<void> callback(LocationDto locationDto) async {
    LocationServiceRepository myLocationCallbackRepository = LocationServiceRepository();
    await myLocationCallbackRepository.callback(locationDto);
  }