Bug: Flutter 3.29 Breaking Changes
Description
https://benamorn.medium.com/today-i-learned-after-upgrading-to-flutter-3-29-0-7c7ab1a97975
Steps to Reproduce
Upgrade to Flutter 3.29
Expected Behavior
Successful Compile
Actual Behavior
e: background_location/android/src/main/kotlin/com/almoullim/background_location/BackgroundLocationPlugin.kt:20:50 Unresolved reference 'context'.
e: background_location/android/src/main/kotlin/com/almoullim/background_location/BackgroundLocationPlugin.kt:20:71 Unresolved reference 'messenger'.
e: background_location/android/src/main/kotlin/com/almoullim/background_location/BackgroundLocationPlugin.kt:21:23 Unresolved reference 'addRequestPermissionsResultListener'.```
Does #240 fix this issue for you?
#240 flutter 3.29.0 error message:
git/background_location-c9ec16ed439443beea6b08e18c1e1869ffc7190a/android/src/main/kotlin/com/almoullim/background_location/LocationUpdatesService.kt:255:19 Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The actual metadata version is 2.1.0, but the compiler version 1.8.0 can read versions up to 1.9.0.
There's a lot of the same, not just one
I'm not sure quite how to read that error. is that saying this package was compiled with newer kotlin than your machine? or the other way around?
Does #240 fix this issue for you?
same issue here... how can i test with that PR before merge? i'm not sure
This issue is caused by the deprecation of io.flutter.plugin.common.PluginRegistry.Registrar. Modifying the deprecated code should resolve the problem. Regarding #240, simply change ext.kotlin_version to = '1.8.22' and version 3.29.0 should compile successfully to solve the compilation errors.
Facing the same issue here:
/background_location/BackgroundLocationPlugin.kt:18:52 Unresolved reference: Registrar
This issue is caused by the deprecation of io.flutter.plugin.common.PluginRegistry.Registrar. Modifying the deprecated code should resolve the problem. Regarding #240, simply change ext.kotlin_version to = '1.8.22' and version 3.29.0 should compile successfully to solve the compilation errors.
Seems like the deprecation warning was intentionally suppressed too https://github.com/Almoullim/background_location/blob/d7acf43253a40a142540cb28c5ee5b0d27317c09/android/src/main/kotlin/com/almoullim/background_location/BackgroundLocationPlugin.kt#L17
Googling around seems like the solution for this is
We had to manually pull those dependencies, remove this import, and modify some code related to PluginRegistry.Registrar.
Which sounds like more work than migrating to some other suggested thing
I don't have the bandwidth to implement this but can merge an MR containing it if others can propose a fix and help with testing to confirm that it works
I've tryed updating my dependency using the quote PR:
background_location:
git:
url: https://github.com/zaave/background_location/
ref: fix-flutter-3.30-build
And i confirm that for me the solutions is working
We had to manually pull those dependencies, remove this import, and modify some code related to PluginRegistry.Registrar.
Which sounds like more work than migrating to some other suggested thing
That's correct. For #240, Only removed the lines containing the @SuppressWarnings("deprecation") annotation and the deprecated function. No other modifications are actually required. It works with version 3.29.0 as long as you delete that deprecated interface.
Only removed the lines containing the @SuppressWarnings("deprecation") annotation and the deprecated function.
what functionality depends on that function though. Shouldn't the deprecated function be replaced with a non-deprecated alternative?
I've tryed updating my dependency using the quote PR:
background_location: git: url: https://github.com/zaave/background_location/ ref: fix-flutter-3.30-buildAnd i confirm that for me the solutions is working
This worked for me, but try to solve the problem and merge it.
I've tryed updating my dependency using the quote PR:
background_location: git: url: https://github.com/zaave/background_location/ ref: fix-flutter-3.30-buildAnd i confirm that for me the solutions is working
This worked for me, but try to solve the problem and merge it.
Sadly this did not work for me
Same issue.
Also this did not work for me as well: background_location: git: url: https://github.com/zaave/background_location/ ref: fix-flutter-3.30-build
for those saying it did not work, are there other errors occurring? what version of flutter are you using?
Flutter 3.29.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision c236373904 (2 weeks ago) • 2025-03-13 16:17:06 -0400 Engine • revision 18b71d647a Tools • Dart 3.7.2 • DevTools 2.42.3
When building in android I am getting:
Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors e: file:///Users/stanimeros/.gradle/caches/8.10.2/transforms/a60c4095f76a35cfd35e0bda2ec2182b/transformed/jetified-kotlin-stdlib-2.1.0.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.8.0. ....
Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 3 warnings
- What went wrong: Execution failed for task ':background_location:compileReleaseKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details
@MoralCode Have you find any solution? Or do you have any idea how to solve this?
No, I havent had time to investigate in any detail and likely won't for a while
The error you posted seems to refer to another log file. Does that file contain any additional information on the errors? Or is its content the same as what you posted?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Same issue with 3.32.5, please fix it. thanks!