Reputation: 81
/Users/macbook/.pub-cache/hosted/pub.dev/flutter_barcode_scanner-2.0.0/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java:71: error: cannot find symbol private FlutterBarcodeScannerPlugin(FlutterActivity activity, final PluginRegistry.Registrar registrar) { ^ symbol: class Registrar location: interface PluginRegistry /Users/macbook/.pub-cache/hosted/pub.dev/flutter_barcode_scanner-2.0.0/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java:78: error: cannot find symbol public static void registerWith(final PluginRegistry.Registrar registrar) { ^ symbol: class Registrar location: interface PluginRegistry /Users/macbook/.pub-cache/hosted/pub.dev/flutter_barcode_scanner-2.0.0/android/src/main/java/com/amolg/flutterbarcodescanner/FlutterBarcodeScannerPlugin.java:244: error: cannot find symbol final PluginRegistry.Registrar registrar, ^ symbol: class Registrar location: interface PluginRegistry Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors
FAILURE: Build failed with an exception.
Compilation failed; see the compiler error output for details.
Run with --info option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 34s Running Gradle task 'assembleDebug'... 34,7s Error: Gradle task assembleDebug failed with exit code 1
After updating Flutter, I started my application.
Upvotes: 8
Views: 959
Reputation: 31
The issue you're facing is due to the flutter_barcode_scanner
library not being updated to support Flutter 3.29.0
. After this Flutter upgrade, some Android APIs were deprecated, and since the original flutter_barcode_scanner
package (last maintained 3 years ago) relies on outdated plugin APIs, it’s causing these compilation errors (e.g., PluginRegistry.Registrar is no longer available).
Here are a few solutions you can try:
flutter_barcode_scanner:
git:
url: https://github.com/decodevM/flutter_barcode_scanner.git
ref: flutter-3.29
Consider using flutter_barcode_scanner_plus: ^3.0.8
, a community-maintained package that’s actively supported and works with recent Flutter releases
Downgrade Flutter to v3.27.1
Fork and Fix It Yourself: Refer to Flutter’s official migration guide for deprecated plugin APIs here: https://docs.flutter.dev/release/breaking-changes/plugin-api-migration
Upvotes: 3