无法使用 flutter_local_notifications
Can't use flutter_local_notifications
我在我的项目中使用了最新版本的 flutter_local_notifications,但一直遇到这个问题
Launching lib/main.dart on Mi A2 in debug mode...
/home/xxx/Desktop/flutter_linux_1.22.6-stable/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-4.0.1+1/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java:1260: error: cannot find symbol
List<NotificationChannel> channels = notificationManagerCompat.getNotificationChannels();
^
symbol: method getNotificationChannels()
location: variable notificationManagerCompat of type NotificationManagerCompat
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_local_notifications:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 25s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
我的flutter版本
Flutter 1.22.6 • channel stable
pubspec.yaml
firebase_messaging: ^9.0.0
firebase_core: ^1.0.0
flutter_local_notifications: ^4.0.1+1
我终于重现了此类问题,可以通过升级或降级插件或从 .pub_chace 中删除插件并安装来解决,在您的情况下 flutter_local_notifications
.
打开 android\build.gradle
找到这个
子项目{
project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.1"
}
}
}
删除project.configurations.all及其所有内容
新代码现在看起来像这样
subprojects { project.evaluationDependsOn(':app') }
扑干净
扑扑酒吧得到
我在我的项目中使用了最新版本的 flutter_local_notifications,但一直遇到这个问题
Launching lib/main.dart on Mi A2 in debug mode...
/home/xxx/Desktop/flutter_linux_1.22.6-stable/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-4.0.1+1/android/src/main/java/com/dexterous/flutterlocalnotifications/FlutterLocalNotificationsPlugin.java:1260: error: cannot find symbol
List<NotificationChannel> channels = notificationManagerCompat.getNotificationChannels();
^
symbol: method getNotificationChannels()
location: variable notificationManagerCompat of type NotificationManagerCompat
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_local_notifications:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 25s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
我的flutter版本
Flutter 1.22.6 • channel stable
pubspec.yaml
firebase_messaging: ^9.0.0
firebase_core: ^1.0.0
flutter_local_notifications: ^4.0.1+1
我终于重现了此类问题,可以通过升级或降级插件或从 .pub_chace 中删除插件并安装来解决,在您的情况下 flutter_local_notifications
.
打开 android\build.gradle 找到这个
子项目{ project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.1"
}
}
}
删除project.configurations.all及其所有内容
新代码现在看起来像这样
subprojects { project.evaluationDependsOn(':app') }
扑干净 扑扑酒吧得到