我正在尝试使用 Android上的 PushWoosh 插件运行基于 Apache Cordova 的应用程序。为了避免 Android 上的碎片问题,我们使用MobileChromeApps来构建我们的 Android 版本的应用程序。但是,我无法通过 PushWoosh 为设备注册推送消息。该代码在 iOS 上完美运行。
一旦我运行,错误就会发生plugins.pushNotification.registerDevice
。
这就是adb logcat
给我的:
D/PushNotifications(17915): Plugin Called
W/System.err(17915): java.lang.NullPointerException
W/System.err(17915): at com.pushwoosh.plugin.pushnotifications.PushNotifications.internalRegister(PushNotifications.java:189)
W/System.err(17915): at com.pushwoosh.plugin.pushnotifications.PushNotifications.execute(PushNotifications.java:390)
W/System.err(17915): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:82)
W/System.err(17915): at org.apache.cordova.PluginManager.exec(PluginManager.java:128)
W/System.err(17915): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:63)
W/System.err(17915): at org.apache.cordova.engine.crosswalk.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)
W/System.err(17915): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err(17915): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28)
W/System.err(17915): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(17915): at android.os.Looper.loop(Looper.java:137)
W/System.err(17915): at android.os.HandlerThread.run(HandlerThread.java:60)
看起来 Java 代码以某种方式失败了——但为什么以及如何失败,我不知道(网络开发人员的心,我不知道 Java)。该应用程序从不调用任何远程资源,因此错误必须在应用程序设置中的某个位置。
有任何想法吗?感谢所有帮助(如果您在哥本哈根,甚至可能会获得啤酒奖励)。
编辑:更详细的研究adb logcat -s System.err
表明初始化也失败了,可能导致另一个错误
W/System.err( 7439): org.json.JSONException: No value for projectid
W/System.err( 7439): at org.json.JSONObject.get(JSONObject.java:354)
W/System.err( 7439): at org.json.JSONObject.getString(JSONObject.java:510)
W/System.err( 7439): at com.pushwoosh.plugin.pushnotifications.PushNotifications.initialize(PushNotifications.java:174)
W/System.err( 7439): at com.pushwoosh.plugin.pushnotifications.PushNotifications.execute(PushNotifications.java:384)
W/System.err( 7439): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:82)
W/System.err( 7439): at org.apache.cordova.PluginManager.exec(PluginManager.java:128)
W/System.err( 7439): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:63)
W/System.err( 7439): at org.apache.cordova.engine.crosswalk.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)
W/System.err( 7439): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err( 7439): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28)
W/System.err( 7439): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 7439): at android.os.Looper.loop(Looper.java:137)
W/System.err( 7439): at android.os.HandlerThread.run(HandlerThread.java:60)
W/System.err( 7439): java.lang.NullPointerException
W/System.err( 7439): at com.pushwoosh.plugin.pushnotifications.PushNotifications.internalRegister(PushNotifications.java:190)
W/System.err( 7439): at com.pushwoosh.plugin.pushnotifications.PushNotifications.execute(PushNotifications.java:393)
W/System.err( 7439): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:82)
W/System.err( 7439): at org.apache.cordova.PluginManager.exec(PluginManager.java:128)
W/System.err( 7439): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:63)
W/System.err( 7439): at org.apache.cordova.engine.crosswalk.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)
W/System.err( 7439): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err( 7439): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28)
W/System.err( 7439): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 7439): at android.os.Looper.loop(Looper.java:137)
W/System.err( 7439): at android.os.HandlerThread.run(HandlerThread.java:60)
W/System.err( 7439): java.lang.NullPointerException
W/System.err( 7439): at com.pushwoosh.plugin.pushnotifications.PushNotifications.internalRegister(PushNotifications.java:190)
W/System.err( 7439): at com.pushwoosh.plugin.pushnotifications.PushNotifications.execute(PushNotifications.java:393)
W/System.err( 7439): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:82)
W/System.err( 7439): at org.apache.cordova.PluginManager.exec(PluginManager.java:128)
W/System.err( 7439): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:63)
W/System.err( 7439): at org.apache.cordova.engine.crosswalk.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)
W/System.err( 7439): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err( 7439): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28)
W/System.err( 7439): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 7439): at android.os.Looper.loop(Looper.java:137)
W/System.err( 7439): at android.os.HandlerThread.run(HandlerThread.java:60)
太感谢了!