12

This sample application of mine used to work just fine.

Somewhere in the past few months, though, Google updated Google Play Services (and Chromecast itself), and now when I call play() on RemotePlaybackClient for the Chromecast, Google Play Services itself crashes with:

E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
        at com.google.android.gms.cast.media.aq.a(SourceFile:96)
        at com.google.android.gms.cast.media.n.i(SourceFile:1856)
        at com.google.android.gms.cast.media.u.run(SourceFile:2092)
        at android.os.Handler.handleCallback(Handler.java:730)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5103)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)

Note that the play() call itself has the desired effect, in that the Chromecast plays the media. But sometime after it calls the ItemActionCallback with onResult(), the aforementioned crash in Google PLay Services occurs. That, in turn, causes the connection to the Chromecast to collapse, so my MediaRouteActionProvider vanishes and I have to re-run my app to connect again, despite the Chromecast actually playing the media that I requested.

I have tested this with two devices (Nexus 4 and Galaxy Nexus) with the same results.

I have even created a new app, trying to just show an image (instead of play a movie, as with the original sample), and I get the same crash.

Has anyone seen this and found some workaround/fix/whatever?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • What version of Google Play Services is on your devices? – ianhanniballake Nov 13 '14 at 00:35
  • @ianhanniballake: `version 6.1.88 (1557022-036)` on the Nexus 4, which I happen to have handy right at this moment. If you need the Galaxy Nexus one, let me know. – CommonsWare Nov 13 '14 at 00:41
  • 7
    That awkward moment When @Commonsware got a crash :D and He Can't solve it... :) – Nadeem Iqbal Nov 19 '14 at 07:23
  • https://github.com/googlecast/CastVideos-android/commits/master FWIW - google CC samples source get upd when libs r revise. This CC example which u dont use so big deal. I hav use this for CC apps over almost 2 years. My android, CC app periodically break for no apparent reason. In which case, I go back to git n rePULL , Merge the project that was originally clone for my work and voila - mysterious bugs gone with new merged code. Merge can be somewhat involve has been worth effort because merge always solv bug. In general, that may be a reason to make use of the CC samples available. – Robert Rowntree Nov 19 '14 at 19:02
  • @RobertRowntree: I am using `RemotePlaybackClient`. I have zero interest in the Cast SDK. Thanks, though! – CommonsWare Nov 19 '14 at 20:34
  • If you can produce a short test case that exhibits the issue, we can take a look and address the issue if there is something on the Play Services side. In that case, please open a ticket on our issue tracker with your sample/test. – Ali Naddaf Nov 22 '14 at 17:48
  • 1
    @AliNaddaf: What is "our issue tracker"? I am not aware that Play Services has an issue tracker, and http://b.android.com rejects all Play Services-related questions. BTW, I updated my sample (linked to in the question) to use `21.0.0` of `mediarouter-v7` (and `appcompat-v7`), and the problem persists. Thanks! – CommonsWare Nov 22 '14 at 18:02
  • 1
    The stacktrace you are showing seems to be happening in the cast portion of play services and as such, you can open a ticket on our Cast SDK tracker (https://code.google.com/p/google-cast-sdk/issues/list). We would need a test case that can exhibit the issue so we can address it properly. – Ali Naddaf Nov 23 '14 at 00:30
  • @AliNaddaf: Filed as https://code.google.com/p/google-cast-sdk/issues/detail?id=434 -- thanks! – CommonsWare Nov 23 '14 at 00:57
  • The next version of Google Play Services includes a fix for this issue. – Ali Naddaf Nov 23 '14 at 01:37
  • @AliNaddaf: I can confirm that the bug is now fixed, and my sample works again. Many thanks! – CommonsWare Dec 06 '14 at 21:22

2 Answers2

1

As noted in the comment chain, this was caused by a bug in Google Play Services, which is now fixed. Many thanks to Ali Naddaf for his assistance!

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
-1

Something with your video is causing GMS to crash. I ran into the same issue with your sample app. I changed your video to point to: http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 and it worked.

drewpt
  • 46
  • 1
  • 4