You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered multiple errors while trying to build my Flutter project using the background_location_tracker plugin. The errors are related to accessing and overriding the lifecycle property and method within the plugin's Kotlin code.
Steps to Reproduce:
Add the background_location_tracker plugin to the pubspec.yaml file.
Attempt to build the Flutter project.
Observe the build errors related to the lifecycle property in the BackgroundLocationTrackerPlugin.kt file.
Error Messages:
e: file:///C:/Users/majma/AppData/Local/Pub/Cache/hosted/pub.dev/background_location_tracker-1.4.3/android/src/main/kotlin/com/icapps/background_location_tracker/BackgroundLocationTrackerPlugin.kt:90:50 Cannot access 'lifecycle': it is private in 'ProxyLifecycleProvider'
e: file:///C:/Users/majma/AppData/Local/Pub/Cache/hosted/pub.dev/background_location_tracker-1.4.3/android/src/main/kotlin/com/icapps/background_location_tracker/BackgroundLocationTrackerPlugin.kt:115:9 Cannot weaken access privilege 'public' for 'lifecycle' in 'LifecycleOwner'
e: file:///C:/Users/majma/AppData/Local/Pub/Cache/hosted/pub.dev/background_location_tracker-1.4.3/android/src/main/kotlin/com/icapps/background_location_tracker/BackgroundLocationTrackerPlugin.kt:115:21 'lifecycle' hides member of supertype 'LifecycleOwner' and needs 'override' modifier
e: file:///C:/Users/majma/AppData/Local/Pub/Cache/hosted/pub.dev/background_location_tracker-1.4.3/android/src/main/kotlin/com/icapps/background_location_tracker/BackgroundLocationTrackerPlugin.kt:167:9 'getLifecycle' overrides nothing
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Environment:
The lifecycle property in ProxyLifecycleProvider is private, leading to access errors.
Access Modifier Conflict:
The code is trying to change the access modifier of lifecycle from public, which is not allowed.
Missing override Modifier:
The lifecycle property needs an override modifier when overriding a superclass member.
getLifecycle Method:
The getLifecycle() method seems to be incorrectly marked as override without a matching method in the superclass.
Suggested Fixes:
Verify the correct access level of the lifecycle property and ensure that the override keyword is used where necessary.
Make sure the plugin is compatible with the current versions of Flutter, Dart, and AndroidX.
Update the plugin if a newer version is available that addresses these issues.
Consider refactoring the Kotlin code to properly handle the lifecycle property.
Additional Context:
The errors started appearing after upgrading to the latest version of Flutter and AndroidX. If the plugin is outdated or incompatible with the new versions, a fix or update may be necessary.
The text was updated successfully, but these errors were encountered:
Feel free to look the code's modifications and try it if you want. The example project is not running. There is an issue related with the flutter_local_notifications plugin I ignored. However, is possible to try it on others projects changing the plugin's import on pubspec.yaml file this way:
Thanks @Jeferson505, your fork works perfectly fine for me. If it is okay with you letting others mention your fork directly in their project, then they could use this in their pubspec
I encountered multiple errors while trying to build my Flutter project using the background_location_tracker plugin. The errors are related to accessing and overriding the lifecycle property and method within the plugin's Kotlin code.
Steps to Reproduce:
Add the background_location_tracker plugin to the pubspec.yaml file.
Attempt to build the Flutter project.
Observe the build errors related to the lifecycle property in the BackgroundLocationTrackerPlugin.kt file.
Error Messages:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Environment:
Flutter Version: [Your Flutter version]
Dart Version: [Your Dart version]
Plugin Version: background_location_tracker 1.4.3
Android SDK Version: [Your Android SDK version]
Kotlin Version: [Your Kotlin version]
Possible Causes and Suggestions:
Private Access to lifecycle:
The lifecycle property in ProxyLifecycleProvider is private, leading to access errors.
Access Modifier Conflict:
The code is trying to change the access modifier of lifecycle from public, which is not allowed.
Missing override Modifier:
The lifecycle property needs an override modifier when overriding a superclass member.
getLifecycle Method:
The getLifecycle() method seems to be incorrectly marked as override without a matching method in the superclass.
Suggested Fixes:
Verify the correct access level of the lifecycle property and ensure that the override keyword is used where necessary.
Make sure the plugin is compatible with the current versions of Flutter, Dart, and AndroidX.
Update the plugin if a newer version is available that addresses these issues.
Consider refactoring the Kotlin code to properly handle the lifecycle property.
Additional Context:
The errors started appearing after upgrading to the latest version of Flutter and AndroidX. If the plugin is outdated or incompatible with the new versions, a fix or update may be necessary.
The text was updated successfully, but these errors were encountered: