Flutter intl版本冲突引发awesome_notifications构建失败及Java编译错误求助
Flutter intl版本冲突引发awesome_notifications构建失败及Java编译错误求助
我现在遇到了一个棘手的Flutter包版本冲突问题,折腾了好一阵都没找到干净的解决办法,来求助大家!
问题背景
我的项目里几个依赖的intl版本要求互相冲突,具体情况是:
flutter_localizations依赖intl: 0.19.0- 我原本项目里用的是
intl: ^0.20.0 awesome_notifications: ^0.10.1同样依赖intl: ^0.20.0
为了适配flutter_localizations,我把intl降级到了0.19.0,结果awesome_notifications新版本不兼容这个intl版本,只能跟着降级到0.10.0。但降级后,构建时又出现了Java编译错误:
DartBackgroundExecutor.java:74: error: cannot find symbol private static io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback ^ symbol: class PluginRegistrantCallback location: interface PluginRegistry DartBackgroundExecutor.java:86: error: cannot find symbol io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) { ^ symbol: class PluginRegistrantCallback location: interface PluginRegistry
当前困境
现在我陷入了两难:
- 用intl 0.19.0:
flutter_localizations正常,但awesome_notifications 0.10.0出现上述Java编译错误 - 用intl 0.20.0:
awesome_notifications正常,但flutter_localizations版本冲突
我需要的帮助
我希望能找到以下两种解决方案之一:
- 让
flutter_localizations、intl、awesome_notifications三者能兼容共存的方法 - 解决
awesome_notifications 0.10.0中PluginRegistrantCallback找不到的问题的临时/workaround方案
最好是不用手动fork修改包的干净解决办法,真的太感谢大家了!
附flutter doctor -v输出
[√] Flutter (Channel stable, 3.29.3, on Microsoft Windows [Version 10.0.26100.3915], locale en-IN) [458ms] • Flutter version 3.29.3 on channel stable at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000 • Engine revision cf56914b32 • Dart version 3.7.2 • DevTools version 2.42.3 [√] Windows Version (11 Home Single Language 64-bit, 24H2, 2009) [2.9s] [√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [3.6s] • Android SDK at C:\Users\imhpa\AppData\Local\Android\sdk • Platform android-35, build-tools 35.0.0 • Java binary at: C:\Users\imhpa\AppData\Local\Programs\Android Studio\jbr\bin\java This is the JDK bundled with the latest Android Studio installation on this machine. To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`. • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42) • All Android licenses accepted. [√] Chrome - develop for the web [126ms] • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.3) [124ms] • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.11.35303.130 • Windows 10 SDK version 10.0.22621.0 [√] Android Studio (version 2024.3) [23ms] • Android Studio at C:\Users\imhpa\AppData\Local\Programs\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42) [√] VS Code (version 1.99.3) [21ms] • VS Code at C:\Users\imhpa\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.110.0 [√] Connected device (3 available) [375ms] • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26100.3915] • Chrome (web) • chrome • web-javascript • Google Chrome 135.0.7049.115 • Edge (web) • edge • web-javascript • Microsoft Edge 136.0.3240.50 [√] Network resources [671ms] • All expected network resources are available. • No issues found!
内容来源于stack exchange
相关产品推荐
相关产品推荐

