Android应用Chrome Cast会话启动失败(错误码15)求助
排查Chrome Cast会话启动失败(错误码15)的方案
我之前参考官方教程在Android应用中实现了Chrome Cast投屏功能,原本能正常投屏视频,配置没做任何变更(Receiver Application ID用的是DEFAULT_MEDIA_RECEIVER_APPLICATION_ID),但现在启动会话时出现问题:
- 能正常进入
onSessionStarting回调 - 但随后触发
onSessionStartFailed,错误码为15
回调代码片段
@Override public void onSessionStarting(CastSession session) { // 能够进入此方法 } @Override public void onSessionStartFailed(CastSession session, int error) { // error =15 }
相关Logcat日志(部分截断)
05-18 19:13:53.757 16733-16733/? E/SdkNetworkParameterUtils: getNetworkOperatorForSubscription [int] 05-18 19:14:04.022 16733-16733/? E/SdkNetworkParameterUtils: getNetworkOperatorForSubscription [int] 05-18 19:14:13.726 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:13.726 859-1019/? E/QC-time-services: Receive Passed == base = 12, unit = 1, operation = 0, result = 0 05-18 19:14:13.734 859-1019/? E/QC-time-services: Receive Passed == base = 13, unit = 1, operation = 0, result = 0 05-18 19:14:13.737 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:13.306 685-1529/? E/QC-time-services: Daemon:Update to modem bit set 05-18 19:14:13.307 31403-31403/? E/QC-time-services: Receive Passed == base = 2, unit = 1, operation = 0, result = 0 05-18 19:14:13.307 685-751/? E/QC-time-services: Daemon:tod_update_ind_cb: Got Update from modem msg_id 40 05-18 19:14:13.307 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:17.437 16733-16733/? E/SdkNetworkParameterUtils: getNetworkOperatorForSubscription [int] 05-18 19:14:21.084 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:21.084 859-1019/? E/QC-time-services: Receive Passed == base = 12, unit = 1, operation = 0, result = 0 05-18 19:14:21.095 859-1019/? E/QC-time-services: Receive Passed == base = 13, unit = 1, operation = 0, result = 0 05-18 19:14:21.095 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:22.343 685-1707/? E/QC-time-services: Daemon:Update to modem bit set 05-18 19:14:22.343 31403-31403/? E/QC-time-services: Receive Passed == base = 2, unit = 1, operation = 0, result = 0 05-18 19:14:22.344 685-751/? E/QC-time-services: Daemon:tod_update_ind_cb: Got Update from modem msg_id 40 05-18 19:14:22.344 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:27.721 16733-16733/? E/SdkNetworkParameterUtils: getNetworkOperatorForSubscription [int] 05-18 19:14:43.076 16733-16733/? E/SdkNetworkParameterUtils: getNetworkOperatorForSubscription [int] 05-18 19:14:50.931 712-712/? E/cnss-daemon: Stale or unreachable neighbors, ndm state: 16 05-18 19:14:52.242 1521-1995/? E/IzatSvc_Wiper: W/Num of elements returned by LOWI 5 05-18 19:14:53.095 700-24959/? E/AudioFlinger: open /proc/28333/cmdline error 05-18 19:14:54.964 710-928/? E/QC-time-services: Receive Passed == base = 12, unit = 1, operation = 0, result = 0 05-18 19:14:54.965 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:54.973 710-928/? E/QC-time-services: Receive Passed == base = 13, unit = 1, operation = 0, result = 0 05-18 19:14:54.973 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:56.324 685-1795/? E/QC-time-services: Daemon:Update to modem bit set 05-18 19:14:56.325 31403-31403/? E/QC-time-services: Receive Passed == base = 2, unit = 1, operation = 0, result = 0 05-18 19:14:56.327 685-751/? E/QC-time-services: Daemon:tod_update_ind_cb: Got Update from modem msg_id 40 05-18 19:14:56.327 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:58.048 710-928/? E/QC-time-services: Receive Passed == base = 12, unit = 1, operation = 0, result = 0 05-18 19:14:58.049 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:58.055 710-928/? E/QC-time-services: Receive Passed == base = 13, unit = 1, operation = 0, result = 0 05-18 19:14:58.056 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:58.269 685-1822/? E/QC-time-services: Daemon:Update to modem bit set 05-18 19:14:58.271 685-751/? E/QC-time-services: Daemon:tod_update_ind_cb: Got Update from modem msg_id 40 05-18 19:14:58.271 685-739/? E/QC-time-services: Daemon: Time-services: Waiting to acceptconnection 05-18 19:14:58.272 31403-31403/? E/QC-time-services: Receive Passed == base = 2, unit = 1, operation = 0, result = 0 05-18 19:15:08.403 16733-16733/? E/SdkNetworkParameterUtils: getNetworkOperatorForSubscription [int] 05-18 19:15:13.624 712-712/? E/cns
具体排查方向
错误码15对应CastStatusCodes.ERROR_RECEIVER_NOT_FOUND,说明系统无法找到或连接到指定的接收器应用。结合你的情况,推荐按以下步骤排查:
确认网络环境一致性
- 确保Android设备和Cast设备处于同一个WiFi网络,且网络未开启AP隔离(很多路由器默认开启,会阻止设备间通信)。
- 尝试重启路由器和Cast设备,排除临时网络故障。
验证接收器ID有效性
- 虽然你用的是默认ID,但可以尝试直接替换为字符串形式的官方默认接收器ID:
CC1AD845,避免常量引用可能出现的问题。 - 确认Cast设备支持默认媒体接收器(大部分现代Cast设备都支持,但旧固件可能存在兼容性问题)。
- 虽然你用的是默认ID,但可以尝试直接替换为字符串形式的官方默认接收器ID:
检查应用权限与系统设置
- 确认应用已申请并获得
ACCESS_WIFI_STATE、CHANGE_WIFI_STATE权限,这些是Cast设备发现和连接的必要权限。 - 关闭Android设备上的VPN、代理设置,这类服务会干扰Cast的网络通信。
- 确认应用已申请并获得
获取更精准的Cast日志
- 当前日志中缺乏Cast相关的核心信息,建议在Logcat中过滤标签为
Cast、CastSdk、SessionManager的日志,能找到更详细的失败原因描述,比如接收器超时、连接拒绝等。
- 当前日志中缺乏Cast相关的核心信息,建议在Logcat中过滤标签为
更新SDK与设备固件
- 升级应用中的Cast SDK到最新版本,修复已知的兼容性问题。
- 在Google Home应用中检查Cast设备的固件更新,旧固件可能无法适配最新的SDK。
交叉测试验证
- 用YouTube、Netflix等官方应用测试投屏,如果这些应用也无法投屏,说明问题出在Cast设备或网络;如果能正常投屏,那问题大概率在你的应用代码或配置中。
内容的提问来源于stack exchange,提问作者Sumitkumar Dhule
相关产品推荐
相关产品推荐

