在 android 上导入 nativescript-local-notifications 时出错

Importing nativescript-local-notifications error on android

我目前正在尝试导入插件 nativescript-local-notifications。 这个插件允许我们在旅途中创建本地推送通知,而无需使用服务器。

下面的错误是我启动应用程序时遇到的错误:

var LocalNotifications = require("nativescript-local-notifications");

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yeagger.app/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed TypeError: Cannot read property 'registerCallbacks' of undefined

这是插件的问题还是我做错了什么?

查看 github 中的问题后,我发现清理整个项目会有所帮助。 https://github.com/EddyVerbruggen/nativescript-local-notifications/issues/108

我之前已经这样做过,但同时我删除并添加了其他几个插件。这可能与本地通知冲突。

第二次这样做后,确实成功了。

tns platform clean android