android - 带有 PushPlugin 编译失败的 Phonegap Android

标签 android cordova

我正在尝试运行安装了 PushPlugin 的 phonegap 应用程序。 我用这个命令添加插件:

$ phonegap local plugin add https://github.com/phonegap-build/PushPlugin

一切顺利。 我将 PushNotification.js 文件添加到我的“www”文件夹并在 index.html 中引用它。 然后我在 index.js 文件中添加了一些代码来处理通知。 我尝试运行该应用程序:

$ phonegap local run android

得到这个:

-compile:
[javac] Compiling 8 source files to /Users/nadavelyashiv/Code/PushNotificationSample/platforms/android/bin/classes
[javac] /Users/nadavelyashiv/Code/PushNotificationSample/platforms/android/src/com/plugin/gcm/GCMIntentService.java:96: cannot find symbol
[javac] symbol  : method getString(java.lang.String)
[javac] location: class com.plugin.gcm.GCMIntentService
[javac]                 .setTicker(getString("title"))
[javac]                            ^
[javac] /Users/nadavelyashiv/Code/PushNotificationSample/platforms/android/src/com/plugin/gcm/GCMIntentService.java:95: cannot find symbol
[javac] symbol  : method getString(java.lang.String)
[javac] location: class com.plugin.gcm.GCMIntentService
[javac]                 .setContentTitle(getString("title"))
[javac]                                  ^
[javac] 2 errors
BUILD FAILED
/usr/local/Cellar/android-sdk/r22.0.4/tools/ant/build.xml:720: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/r22.0.4/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

这里似乎有什么问题? 谢谢。

最佳答案

发现问题,在项目上创建了一个 PullRequest:

https://github.com/phonegap-build/PushPlugin/pull/83/files

你应该更新android/com/plugin/gcm/GCMIntentService.java第95和96行的代码

            .setContentTitle(extras.getString("title"))
            .setTicker(extras.getString("title"))

关于android - 带有 PushPlugin 编译失败的 Phonegap Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19199921/

相关文章:

android - 如何在窗口管理器 View 中获得焦点

javascript - 在 iOS 4.0.0 中从 Native 调用 Cordova 插件 Javascript 函数

cordova - 将 angular 应用程序移植到 ionic

android - 每次我打开 Phonegap 应用程序时,它都会重新启动。有返回同一页面的建议吗?

javascript - 以 Angular 返回页面时加载提要不起作用

android - 如何向我的移动应用程序添加高级动画?

android - 如何在 Android 浏览器上读取使用外部脚本动态加载的元素的 CSS 属性?

java - 是否有必要在分离时将 Fragment 接口(interface)监听器设置为 null?

java - 选择图库中的图像

javascript - 没有 JQuery Mobile 的多页 Phonegap 应用程序