After updating to Flutter 3.29, the application no longer starts on the Android system - Stack Overflow

Usersmacbook.pub-cachehostedpub.devflutter_barcode_scanner-2.0.0androidsrcmainjavacomamolg

/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.

  • What went wrong: Execution failed for task ':flutter_barcode_scanner:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:

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.

/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.

  • What went wrong: Execution failed for task ':flutter_barcode_scanner:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:

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.

Share Improve this question asked Feb 21 at 5:57 Moustapha MbouombouoMoustapha Mbouombouo 891 silver badge2 bronze badges 2
  • benamorn.medium/… – pskink Commented Feb 21 at 6:15
  • 2 This package didn't support flutter 3.29 because it remove some API you have to downgrade your project version or migrate to another lib or fork this lib and made it compatible (read in first comment link) – Lightn1ng Commented Feb 21 at 8:57
Add a comment  | 

1 Answer 1

Reset to default 4

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:

  1. Use a Community Fix Branch: A fork of the library has been updated to work with Flutter 3.29. Add this to your pubspec.yaml:
flutter_barcode_scanner:
  git:
    url: https://github/decodevM/flutter_barcode_scanner.git
    ref: flutter-3.29
  1. Consider using flutter_barcode_scanner_plus: ^3.0.8, a community-maintained package that’s actively supported and works with recent Flutter releases

  2. Downgrade Flutter to v3.27.1

  3. 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745165740a4614617.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信