Android:仅在发布版本中投放Cast SDK v3会崩溃 [英] Android: Cast SDK v3 Crashing in Release build only

查看:80
本文介绍了Android:仅在发布版本中投放Cast SDK v3会崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试运行我的应用的发行版时,尝试使用任何Google Cast功能都会立即崩溃

Whenever I try to run a release build of my app, I immediately get a crash when attempting to use any of the Google Cast features

java.lang.IllegalStateException: Failed to initialize CastContext.

Caused by: java.lang.IllegalAccessException: java.lang.Class<editpackagename.utils.CastOptionsProvider> is not accessible from java.lang.Class<com.google.android.gms.cast.framework.CastContext>
                                                   at java.lang.Class.newInstance(Native Method)
                                                   at com.google.android.gms.cast.framework.CastContext.zzbd(Unknown Source) 
                                                   at com.google.android.gms.cast.framework.CastContext.getSharedInstance(Unknown Source) 
                                                   at editpackagename.activities.MainActivity.onCreate(MainActivity.java:52) 

当我在MainActivity中调用此崩溃时,就会发生该崩溃

That crash happens as soon as I call this in MainActivity:

CastContext castContext = CastContext.getSharedInstance(this);

如果我运行调试版本,一切都会按预期进行.使用Play服务投射框架9.4.0.

If I run a debug build, everything works as expected. Using Play Services cast-framework 9.4.0.

推荐答案

将CastOptionsProvider设为公开,这似乎已经解决了.不知道是否是因为该类是否在子包中,但看起来还不错.文档没有任何访问修饰符.

Made CastOptionsProvider public, and that seems to have taken care of it. Not sure if it's because the class is in a subpackage or not, but looks fine. Documentation doesn't have any access modifiers.

这篇关于Android:仅在发布版本中投放Cast SDK v3会崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆