Flutter 通知侦听器 v2 示例将无法运行

问题描述

我正在尝试测试此代码https://pub.dev/packages/android_notification_listener2/example

添加

<service android:name="com.emilecode.android_notification_listener2.NotificationListener"
   android:label="notifications"
   android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
   <intent-filter>
       <action android:name="android.service.notification.NotificationListenerService" />
   </intent-filter>
</service>

在android -> app -> src -> main -> <application></application>间的AndroidManifest.xml。

在 pubspec.yaml 中,我将 android_notification_listener2: ^2.0.1 添加到依赖项中。

当我尝试运行时,这是输出

e: C:\Users\me\Flutter\.pub-cache\hosted\pub.dartlang.org\android_notification_listener2-2.0.1\android\src\main\kotlin\com\emilecode\android_notification_listener2\AndroidNotificationListener2Plugin.kt: (76,7): Type inference Failed: Cannot infer type parameter V in inline operator fun <K,V> MutableMap<K,V>.set(key: K,value: V): Unit
None of the following substitutions
receiver: MutableMap<String,Any>  arguments: (String,Any)
receiver: MutableMap<String,String?>  arguments: (String,String?)
can be applied to
receiver: kotlin.collections.HashMap<String,Any> /* = java.util.HashMap<String,Any> */  arguments: (String,String?)


FAILURE: Build Failed with an exception.

* What went wrong:
Execution Failed for task ':android_notification_listener2:compileDebugKotlin'.
> Compilation error. See log for more 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 4s
Exception: Gradle task assembleDebug Failed with exit code 1

有人知道如何解决这个问题吗? (顺便说一句,我在 Windows 上运行)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)