Cordova Plugin error on Android 5

Comments

22 comments

  • Avatar
    Max Konev

    Could you please paste full logs?

    Somehow Cordova lost reference to the plugin.

  • Avatar
    bend0303

    Hey, did you get it fixed? I'm having same issue

  • Avatar
    bend0303

    Hey did you get any info regard that error? Pushwoosh registration not working on Android 5 with same error

  • Avatar
    joelcogley

    Unfortunately, the solution I found was to stop using pushwoosh. After backing everything out, I started over with the native Cordova plugin which I finally got working.

  • Avatar
    Alexander Spotar

    @bend0303 could you please send your logs then?

  • Avatar
    Max Konev

    I'm very sorry to hear that. I'm sure the logs would helped that time to identify the issue and resolve the issue.

  • Avatar
    Mobile

    Hi shader,

    same problem here but using Titanium on a Nexus 5 with Android 5. Here is the full log of a failed unregister/register sequence:

    [ERROR] : [Nexus 5] Pushwoosh: Request manager: ERROR: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference. Response = null
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.startsWith(java.lang.String)' on a null object reference
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.internal.http.StatusLine.<init>(StatusLine.java:24)
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.Response$Builder.statusLine(Response.java:419)
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.internal.http.JavaApiConverter.createOkResponse(JavaApiConverter.java:116)
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.internal.http.ResponseCacheAdapter.get(ResponseCacheAdapter.java:53)
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:190)
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:373)
    [ERROR] : [Nexus 5] Pushwoosh: Request manager: at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106)

  • Avatar
    Max Konev

    For some reason Titanium tried to cache "POST" request and crashes. Caching POST requests are not allowed. Which Titanium version do you use?

  • Avatar
    Mobile

    The latest official SDK 3.4.1.

    But the same exact build works on all Android 4.x devices, the issue is only on Lollipop. Did you look at an actual run or are you guessing Titanium is caching the request by the class names? Please note that use of the okhttp classes and methods has been modified by Google several times in recent Google Play Services deployments, so this may have been introduced there.

    By the way, if it is the same error on Titanium and on Cordova, looks like it's between your code and the OS.

  • Avatar
    synergyw

    @banzaimedia I am having no issues with PW running Cordova on Lollipop.

  • Avatar
    Mobile

    Glad for you, I'm not using Cordova at all so I'm only supporting what @joelcogley said by confirming that the SAME EXACT ERROR MESSAGE appears on Titanium too, so the issue is definitely there.

    I can't say if this happens always, on all devices, on all configs.

    That's typical bug's life ;-)

  • Avatar
    Mobile

    @shader, any news on this? It is very critical for us...

  • Avatar
    Max Konev

    You need to update Titanium SDK: See the following problems in their JIRA https://jira.appcelerator.org/browse/TIMOB-17477 https://jira.appcelerator.org/browse/TIMOB-17877

  • Avatar
    Mobile

    I'm already using the 3.4.1 SDK which fixed those tickets. Anyway, I provided the PW support team with a basic project that replicates the issue, so let's wait for their investigation.

  • Avatar
    Max Konev

    did you forget to call onDeviceReady?

  • Avatar
    Max Konev

    The problem is in the TiResponseCache.java file. Considering the comments 3.4.1 SDK still experience the same issue. :( see this: https://github.com/appcelerator/titanium_mobile/pull/6256/files

  • Avatar
    Mobile

    The Pushwoosh issue is still there with SDK 3.5.0, which came long after the most recent activity on those tickets.

    Still a bit perplexed since the same problem is in Cordova and TiResponseCache is obviously not part of Cordova.

    The Response Cache saga started with a Google Play Services release which broke a lot of things, to the point where the Google team rolled back the global release. See this https://jira.appcelerator.org/browse/TIMOB-17798

  • Avatar
    justice

    Hi. I have same problem on Motorola G Lollipop 5.0.2. Here is a log:

    03-25 23:38:18.236: W/System.err(17766): at com.pushwoosh.plugin.pushnotifications.PushNotifications.initialize(PushNotifications.java:175) 03-25 23:38:18.236: W/System.err(17766): at com.pushwoosh.plugin.pushnotifications.PushNotifications.execute(PushNotifications.java:384) 03-25 23:38:18.236: W/System.err(17766): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:84) 03-25 23:38:18.236: W/System.err(17766): at org.apache.cordova.PluginManager.exec(PluginManager.java:151) 03-25 23:38:18.236: W/System.err(17766): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:63) 03-25 23:38:18.236: W/System.err(17766): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40) 03-25 23:38:18.236: W/System.err(17766): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) 03-25 23:38:18.236: W/System.err(17766): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28) 03-25 23:38:18.236: W/System.err(17766): at android.os.Handler.dispatchMessage(Handler.java:102) 03-25 23:38:18.236: W/System.err(17766): at android.os.Looper.loop(Looper.java:135) 03-25 23:38:18.236: W/System.err(17766): at android.os.HandlerThread.run(HandlerThread.java:61) 03-25 23:38:18.236: W/PluginManager(17766): THREAD WARNING: exec() call to PushNotification.onDeviceReady blocked the main thread for 25ms. Plugin should use CordovaInterface.getThreadPool(). 03-25 23:38:18.265: D/PushNotifications(17766): Plugin Called 03-25 23:38:18.265: W/System.err(17766): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.arellomobile.android.push.PushManager.registerForPushNotifications()' on a null object reference 03-25 23:38:18.266: W/System.err(17766): at com.pushwoosh.plugin.pushnotifications.PushNotifications.internalRegister(PushNotifications.java:191) 03-25 23:38:18.266: W/System.err(17766): at com.pushwoosh.plugin.pushnotifications.PushNotifications.execute(PushNotifications.java:392) 03-25 23:38:18.266: W/System.err(17766): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:84) 03-25 23:38:18.266: W/System.err(17766): at org.apache.cordova.PluginManager.exec(PluginManager.java:151) 03-25 23:38:18.266: W/System.err(17766): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:63) 03-25 23:38:18.266: W/System.err(17766): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40) 03-25 23:38:18.266: W/System.err(17766): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) 03-25 23:38:18.266: W/System.err(17766): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:28) 03-25 23:38:18.266: W/System.err(17766): at android.os.Handler.dispatchMessage(Handler.java:102) 03-25 23:38:18.266: W/System.err(17766): at android.os.Looper.loop(Looper.java:135) 03-25 23:38:18.267: W/System.err(17766): at android.os.HandlerThread.run(HandlerThread.java:61)

  • Avatar
    foliba

    Been a while now. I am encountering this error as well. Any update? Running: phonegap 4.2.0 pushwoosh 3.5.1

  • Avatar
    CDK Global

    I am building this app through the AppGyver Build service. The plugin is included fine (I use window.plugins.pushNotification instead of cordova.require(...)). But I am seeing the following error in my registerDevice call:

    Attempt to invoke virtual method 'void com.arellomobile.android.push.PushManager.registerForPushNotifications()' on a null object reference

    I am following the tutorial very closely, but can't get past registering devices. Any help would be great! I see that the threads here are several months old so hopefully the Pushwoosh team has looked into this.

    Update: It's fixed. See my comments

  • Avatar
    CDK Global

    I have gotten the plugin to work! It seems that the Cordova SDK is very particular when it asks for a body onload attribute. After adding that, the plugin works.

  • Avatar
    harding

    Can you explain better how you fixed it?

Please sign in to leave a comment.