flutter_background_service
flutter_background_service copied to clipboard
Cannot find symbol import io.flutter.plugin.common.PluginRegistry.Registrar
After updating Flutter to version 3.28, the flutter_background_service_android library (version 6.2.7) fails to build due to a breaking change in the Flutter API. Specifically, the issue is related to the use of the now-removed Registrar class from the io.flutter.plugin.common.PluginRegistry package.
Here is the error message:
error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
^ symbol: class Registrar
location: interface PluginRegistry
This issue occurs because the Registrar API has been removed in recent versions of Flutter, and the library needs to be updated to use the FlutterPlugin API instead.
Exactly the same issue. There is also in medium: https://benamorn.medium.com/today-i-learned-after-upgrading-to-flutter-3-29-0-7c7ab1a97975
same here
same issue also when i upgrade 1 year old project this issue came i commend on every package still i have issue
Same...
awesome_notifications plugin is also breaking with same error after upgrading flutter sdk to 3.29. Any solutions to this please?
same here with e: file:///Users/luanbatistadev/.pub-cache/hosted/pub.dev/flutter_inapp_purchase-5.6.1/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/FlutterInappPurchasePlugin.kt:10:48 Unresolved reference: Registrar e: file:///Users/luanbatistadev/.pub-cache/hosted/pub.dev/flutter_inapp_purchase-5.6.1/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/FlutterInappPurchasePlugin.kt:100:37 Unresolved reference: Registrar e: file:///Users/luanbatistadev/.pub-cache/hosted/pub.dev/flutter_keychain-2.5.0/android/src/main/kotlin/be/appmire/flutterkeychain/FlutterKeychainPlugin.kt:16:48 Unresolved reference: Registrar e: file:///Users/luanbatistadev/.pub-cache/hosted/pub.dev/flutter_keychain-2.5.0/android/src/main/kotlin/be/appmire/flutterkeychain/FlutterKeychainPlugin.kt:291:37 Unresolved reference: Registrar
I got:
C:\Users\name\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_plugin_android_lifecycle-2.0.19\android\src\main\java\io\flutter\plugins\flutter_plugin_android_lifecycle\FlutterAndroidLifecyclePlugin.java:19: error: cannot find symbol @NonNull io.flutter.plugin.common.PluginRegistry.Registrar registrar) { ^ symbol: class Registrar location: interface PluginRegistry
Same issue happening with Flutter Awesome Notifications package after upgrading latest version to flutter.
A temporary workaround is to downgrade your Flutter version until it's fully compatible. You can use flutter downgrade or doing a git checkout to the last major version inside your flutter SDK folder.
For flutter Awesome Notifications, it worked when I upgraded it to the latest version 0.10.1
I think this issue is no longer related to flutter_background_service
For the problematic packages which haven't done the migration yet, we can lobotomize them in your Pub Cache folder.
Comment out the import and registerWith() method.
Take a look at this pull example: https://github.com/aakashkondhalkar/external_path/pull/13/files
Running on an older version (e.g. 3.27.4) does the trick.
It seems to be related to some deprecated API. The warning you are likely to receive after running on the older version looks as follows:
Note: /Users/{user}/.pub-cache/hosted/pub.dev/flutter_secure_storage-4.2.1/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses or overrides a deprecated API.
Running on an older version (e.g. 3.27.4) does the trick.
It seems to be related to some deprecated API. The warning you are likely to receive after running on the older version looks as follows:
Note: /Users/{user}/.pub-cache/hosted/pub.dev/flutter_secure_storage-4.2.1/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses or overrides a deprecated API.
Yeah, I don't know why many packages out there still call that old API, which is PluginRegistry.Registrar with @Suppress("unused") notation.
That was deprecated a few years ago and is no longer used... since Flutter v2 actually.
Because it was Flutter v1 method, bruh. 😭
That's what causes build failure on the latest flutter because that API has been completely removed.
Running on an older version (e.g. 3.27.4) does the trick. It seems to be related to some deprecated API. The warning you are likely to receive after running on the older version looks as follows:
Note: /Users/{user}/.pub-cache/hosted/pub.dev/flutter_secure_storage-4.2.1/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses or overrides a deprecated API.
Yeah, I don't know why many packages out there still call that old API, which is
PluginRegistry.Registrarwith@Suppress("unused")notation. That was deprecated a few years ago and is no longer used... since Flutter v2 actually. Because it was Flutter v1 method, bruh. 😭That's what causes build failure on the latest flutter because that API has been completely removed.
@topex-psy There is a 10.0.0 version of the flutter_secure_storage package coming out soon. Hope it will be migrated to the new APIs.
@juliansteenbakker Will 10.0.0 contain the migration from PluginRegistry.Registrar to something more up-to-date?
/Users/infoera/.pub-cache/hosted/pub.dev/flutter_geofire-2.0.4/android/src/main/java/in/appyflow/geofire/GeofirePlugin.java:28: error: cannot find symbol import io.flutter.plugin.common.PluginRegistry.Registrar; ^ symbol: class Registrar location: interface PluginRegistry.
please resolve this issue
/Users/infoera/.pub-cache/hosted/pub.dev/flutter_geofire-2.0.4/android/src/main/java/in/appyflow/geofire/GeofirePlugin.java:28: error: cannot find symbol import io.flutter.plugin.common.PluginRegistry.Registrar; ^ symbol: class Registrar location: interface PluginRegistry.
please resolve this issue
Try downgrading your package version.
I believe the problem is related to this file:
packages/flutter_background_service_android/android/src/main/java/id/flutter/flutter_background_service/FlutterBackgroundServicePlugin.java
It has these lines:
public static void registerWith(FlutterEngine engine){ Log.d(TAG, "registering with FlutterEngine"); }
When I remove these, I can build normally on Flutter version 3.29.3
It's not a good way to lower the package version. Compatibility issues with other packages make the problem more complicated. How can I solve this? I have the same problem
what causes build failure on the latest flutter because that API has been completely removed.
Note: /Users/{user}/.pub-cache/hosted/pub.dev/flutter_secure_storage-4.2.1/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses or overrides a deprecated API.
@topex-psy There is a 10.0.0 version of the
flutter_secure_storagepackage coming out soon. Hope it will be migrated to the new APIs.
The latest stable version is 9.2.4 which is already migrated. v4.2.1 is a very old version.
I'm also facing this issue after upgrading to Flutter 3.29.3. Any update on this issue?
This is actually an outdated issue, after upgrading flutter, libs and code stuffs it works fine to me.