Fixed
Status Update
Comments
k....@gmail.com <k....@gmail.com> #2
Thank you for posting.
Kindly provide a sample app with screen recording and steps to reproduce for further checking.
No update yet.
Thank you for posting.
Kindly provide a sample app with screen recording and steps to reproduce for further checking.
Description
It seems that a number of devices in the wild do not support the RouteInfo.getPresentationDisplay() method despite reporting as API 17+.
As a result, a NoSuchMethodError exception is thrown MediaRouterJellybeanMr1.RouteInfo.getPresentationDisplay()'s implementation:
public static Display getPresentationDisplay(Object routeObj) {
return ((android.media.MediaRouter.RouteInfo)routeObj).getPresentationDisplay();
}
Here is an example stack trace:
java.lang.NoSuchMethodError: android.media.MediaRouter$RouteInfo.getPresentationDisplay
at android.support.v7.media.MediaRouterJellybeanMr1$RouteInfo.getPresentationDisplay()
at android.support.v7.media.SystemMediaRouteProvider$JellybeanMr1Impl.onBuildSystemRouteDescriptor()
at android.support.v7.media.SystemMediaRouteProvider$JellybeanImpl.onCreateRouteController()
at android.support.v7.media.SystemMediaRouteProvider$JellybeanImpl.addSystemRouteNoPublish()
at android.support.v7.media.SystemMediaRouteProvider$JellybeanImpl.updateSystemRoutes()
at android.support.v7.media.SystemMediaRouteProvider$JellybeanImpl.()
at android.support.v7.media.SystemMediaRouteProvider$JellybeanMr1Impl.()
at android.support.v7.media.SystemMediaRouteProvider.obtain()
at android.support.v7.media.MediaRouter$GlobalMediaRouter.()
at android.support.v7.media.MediaRouter.getInstance()
at com.google.android.libraries.cast.companionlibrary.cast.BaseCastManager.()
at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.()
The above stack trace happens in the CastCompanionLibrary's BaseCastManager's constructor:
protected BaseCastManager(Context context, String applicationId) {
...
mMediaRouter = MediaRouter.getInstance(mContext);
...
}
Suggested fix would be putting this in a try-catch block and returning null on NoSuchMethodError.
~Philip Peng (phpeng-ms / Keripo)