Yukams / background_locator_fixed

A Flutter plugin for updating location in background.
MIT License
50 stars 102 forks source link

[Bug]: Android compile error #136

Open SaxPlayer opened 1 month ago

SaxPlayer commented 1 month ago

Pubspec entry:

background_locator_2: ^2.0.6

Attempting to run either in debug or release mode on an Android simulator running Android API 35. App crashes and does not launch. Error shown in the console:

`Launching lib/main.dart on sdk gphone64 x86 64 in debug mode... e: file:///Users/saxplayer/.pub-cache/hosted/pub.dev/background_locator_2-2.0.6/android/src/main/kotlin/yukams/app/background_locator_2/provider/LocationParserUtil.kt:21:20 Return type mismatch: expected 'java.util.HashMap<kotlin.Any, kotlin.Any>', actual 'kotlin.collections.HashMap<kotlin.String, it(kotlin.Comparable<*>? & java.io.Serializable?)>'.

FAILURE: Build failed with an exception.

BUILD FAILED in 27s Error: Gradle task assembleDebug failed with exit code 1

Exited (1).`

Flutter doctor:

`Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.2, on macOS 14.6.1 23G93 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] VS Code (version 1.93.0) [✓] Connected device (5 available) [✓] Network resources

• No issues found!`

Using Android NDK version 25.1.8937393

subki commented 1 month ago

i have same problem here, please help

beriaanirudh commented 2 weeks ago

Hi Andy @SaxPlayer , did you find a solution to this? I am facing the same issue. Surprisingly this does not happen on flutter build appbundle but fails for flutter build apk (and I think thats the reason my android-release got rejected).

e: file:///home/beria/.pub-cache/hosted/pub.dev/background_locator_2-2.0.6/android/src/main/kotlin/yukams/app/background_locator_2/provider/LocationParserUtil.kt:21:20 Type mismatch: inferred type is String? but Any was expected
SaxPlayer commented 2 weeks ago

Hi Andy @SaxPlayer , did you find a solution to this? I am facing the same issue. Surprisingly this does not happen on flutter build appbundle but fails for flutter build apk (and I think thats the reason my android-release got rejected).

e: file:///home/beria/.pub-cache/hosted/pub.dev/background_locator_2-2.0.6/android/src/main/kotlin/yukams/app/background_locator_2/provider/LocationParserUtil.kt:21:20 Type mismatch: inferred type is String? but Any was expected

Sadly no. I ended up switching to a different plug-in: background_location_tracker (https://pub.dev/packages/background_location_tracker)